-
-
Notifications
You must be signed in to change notification settings - Fork 86
Reference: Revsets
claytonrcarter edited this page Aug 23, 2022
·
42 revisions
See https://github.com/arxanas/git-branchless/discussions/496 for some ideas and examples on how to use revsets.
The latest grammar is in grammar.lalrpop.
Names are resolved using the same logic as git rev-parse
. Additionally, .
is a synonym for HEAD
.
The following functions are defined:
-
all()
: all visible commits. -
none()
: the empty set of commits. -
union(x, y)
: all commits that are in eitherx
ory
. -
intersection(x, y)
: all commits that are in bothx
andy
. -
difference(x, y)
: all commits that are inx
but not iny
. -
only(x, y)
: all commits which are ancestors ofx
, but not ancestors ofy
. -
range(x, y)
: all commits which are both descendants ofx
and ancestors ofy
. -
ancestors(x)
: all commits which are ancestors of commits inx
.- A commit is an "ancestor" of
x
if itx
or it is a parent of an ancestor ofx
. Note that this definition includesx
itself in the set of ancestors ofx
.
- A commit is an "ancestor" of
-
ancestors.nth(x, n)
: the result of applyingancestors
tox
repeatedn
times. -
descendants(x)
: all commits which are descendants of commits inx
.- A commit is a "descendant" of
x
if itx
or it is a child of a descendant ofx
. Note that this definition includesx
itself in the set of descendants ofx
.
- A commit is a "descendant" of
-
parents(x)
: all commits which are an immediate parent of a commit inx
. -
parents.nth(x, n)
: the result of applyingparents
tox
repeatedn
times. -
children(x)
: all commits which are an immediate child of a commit inx
. -
roots(x)
: all commits inx
which have no immediate ancestors also inx
. -
heads(x)
: all commits inx
which have no immediate descendants also inx
. -
draft()
: all draft commits. -
stack()
: all draft commits in your current commit stack. -
message(text-pattern)
: all commits whose messages match the specified pattern. -
paths.changed(text-pattern)
: all commits with a changed file path matching the specified pattern. -
author.name(text-pattern)
: all commits whose author name matches the specified pattern. -
author.email(text-pattern)
: all commits whose author email matches the specified pattern. -
author.date(date-pattern)
: all commits whose author email matches the specified pattern. -
committer.name(text-pattern)
: all commits whose committer name matches the specified pattern. -
committer.email(text-pattern)
: all commits whose committer email matches the specified pattern. -
committer.date(date-pattern)
: all commits whose committer email matches the specified pattern. -
exactly(x, n)
: all commits inx
, but only ifx
contains exactlyn
commits.
The following unary operations are defined:
-
:x
: same asancestors(x)
.-
::x
is also accepted to be familiar for Mercurial users.
-
-
x:
: same asdescendants(x)
.-
x::
is also accepted to be familiar for Mercurial users.
-
The following binary operations are defined:
-
+
,|
,or
: same asunion
. -
&
,and
: same asintersection
. -
-
: same asdifference
.- Note that
foo-bar
is parsed as a branch name. To force the binary operation parsing, writefoo - bar
instead.
- Note that
-
%
: same asonly
. -
:
: same asrange
.-
::
is also accepted to be familiar for Mercurial users.
-
-
..
: same asonly
.
Text patterns:
-
foo
,substr:foo
,substring:foo
: matches if the text containsfoo
anywhere. -
exact:foo
: matches if the entire text content is exactlyfoo
. -
glob:foo/*
: matches if the text content matches the glob patternfoo/*
anywhere. -
regex:foo.*
: matches if the text content matches the glob patternfoo.*
anywhere.
Dates can be either absolute (2022-01-01
) or relative (1 month ago
). Date patterns:
-
before:date
: matches if the date is beforedate
. -
after:date
: matches if the date is afterdate
.
- 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