-
-
Notifications
You must be signed in to change notification settings - Fork 96
Command: git query
arxanas edited this page Aug 10, 2022
·
29 revisions
New in v0.3.13.
git query
is used to execute queries about the commit graph. You can use the results interactively or as part of your scripts. Since git query
accepts revsets, you can issue more complicated queries than are possible with e.g. git log
.
git query
accepts a revset expression and prints out a list of commit hashes corresponding to the commits that matched that expression. The output is topologically-sorted, i.e. ancestor commits will appear before descendant commits in the list.
By default, git query
prints a list of commits. If you want to get the branches attached to those commits, you can add the --show-branches
option. For example, to get the list of all branches pointing to draft commits, you could run:
$ git query --show-branches 'draft() & branches()'
- Search the Wiki 🔎
- User guide
- Welcome
- Installation
- Tutorial
- Command overview
- General:
- Navigation:
- Committing:
- Rebasing:
- Verification:
- Collaboration:
- Workflows
- Advanced topics
- Reference
- Developer guide
- Onboarding offer
- Development
- Reference