The git log
command has a --boundary
option, which causes the program to
Output excluded boundary commits.
But what is a boundary commit? And when might I want to include them in the output?
A boundary commit is the commit that limits a revision range but does not belong to that range. For example the revision range HEAD~3..HEAD
consists of 3 commits (HEAD~2
, HEAD~1
, and HEAD
), and the commit HEAD~3
serves as a boundary commit for it.
More formally, git processes a revision range by starting at the specified commit and getting at other commits through the parent links. It stops at commits that don't meet the selection criteria (and therefore should be excluded) - those are the boundary commits.
Illustration:
$ mkdir test
$ cd test
$ git init
Initialized empty Git repository in ~/playground/git/test/.git/
$ touch a
$ git add a
$ for i in {1..5}; do echo $i >> a; git commit -m "Commit #$i" a; done
[master (root-commit) bf958f1] Commit #1
1 file changed, 1 insertion(+)
create mode 100644 a
[master 3721a8b] Commit #2
1 file changed, 1 insertion(+)
[master d69efcc] Commit #3
1 file changed, 1 insertion(+)
[master 72cd21d] Commit #4
1 file changed, 1 insertion(+)
[master 17ae9c3] Commit #5
1 file changed, 1 insertion(+)
$ git log --oneline
17ae9c3 Commit #5
72cd21d Commit #4
d69efcc Commit #3
3721a8b Commit #2
bf958f1 Commit #1
$ git log --oneline HEAD~3..
17ae9c3 Commit #5
72cd21d Commit #4
d69efcc Commit #3
$ git log --oneline HEAD~3.. --boundary
17ae9c3 Commit #5
72cd21d Commit #4
d69efcc Commit #3
- 3721a8b Commit #2 <-- This is the boundary commit HEAD~3 that would
not be included in the output had the '--boundary'
option NOT been provided
--boundary
--boundary
argument is to show context of commit(parent revision).
A boundary commit is a commit that does not fall into the "frame" on which a command is executed. (--since, commit range etc)
For example, if you use a parameter like –since=3.weeks
, the commits before three weeks are considered as boundary commits
. Usually boundary
commits are marked with -
You can see in the above screenshot that the last commit is "gone" in the second log. Its due to the --boundary
flag
You can see that there is a o
sign before the commit instead of the *
as in regular commits.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With