Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is a git boundary commit

Tags:

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?

like image 921
Raedwald Avatar asked Feb 24 '17 11:02

Raedwald


2 Answers

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
like image 180
Leon Avatar answered Oct 16 '22 01:10

Leon


--boundary

--boundaryargument 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 -

enter image description here

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.

like image 41
CodeWizard Avatar answered Oct 16 '22 01:10

CodeWizard