So I've been experimenting with groups of commits as discussed here -- Is there a way to group commits in Git? and here -- https://news.ycombinator.com/item?id=27722221
Having simple groups of commits by using git merge --no-ff
worked, but then I decided to try groups of nested sub-groups, and when I tried to view the result with git log --graph
and gitk
I got some weird output.
The test repo I'm using is at https://github.com/maratbn/test_nested_sub_groups_of_commits
This repo contains 2 groups of commits, first one for Feature 1 and a second for Feature 2.
Now, the group for Feature 2 itself contains 2 nested sub-groups of commits, one for Feature 2A and another for Feature 2B.
All of the commits themselves are correctly identifying all of their parents and children, and git log --graph
seems to work correctly just for the feature2
branch:
$ git log --graph --oneline
* 8e4b5f4 (HEAD -> feature2) Merge branch 'feature2b' into feature2
|\
| * 0ce0350 (feature2b) Feature 2B commit 3.
| * c935021 Feature 2B commit 2.
| * 0bb1c7d Feature 2B commit 1.
|/
* 58df7c0 Merge branch 'feature2a' into feature2
|\
| * 682a2ab (feature2a) Feature 2A commit 3.
| * 0f567b0 Feature 2A commit 2.
| * 77a551a Feature 2A commit 1.
|/ (...here the branch was switched to 'feature2'...)
* 1895612 Merge branch 'feature1' (...into 'master'...)
|\
| * 3809d12 (feature1) Feature 1, 3rd commit.
| * ed91ea8 This is for feature 1, 2nd commit.
| * ffe515d First commit for feature 1.
|/
* 228a1ab Added 'test1.txt'.
But after I git merge --no-ff feature2
into master
(to create groups themselves having nested sub-groups) same command produces this weird output:
$ git log --graph --oneline
01 * d6cde88 Merge branch 'feature2'
02 |\
03 | * 8e4b5f4 (feature2) Merge branch 'feature2b' into feature2
04 | |\
05 | | * 0ce0350 (feature2b) Feature 2B commit 3.
06 | | * c935021 Feature 2B commit 2.
07 | | * 0bb1c7d Feature 2B commit 1.
08 | |/
09 | * 58df7c0 Merge branch 'feature2a' into feature2
10 | |\
11 |/ /
12 | * 682a2ab (feature2a) Feature 2A commit 3.
13 | * 0f567b0 Feature 2A commit 2.
14 | * 77a551a Feature 2A commit 1.
15 |/ (...here the branch was switched to 'feature2'...)
16 * 1895612 Merge branch 'feature1'
17 |\
18 | * 3809d12 (feature1) Feature 1, 3rd commit.
19 | * ed91ea8 This is for feature 1, 2nd commit.
20 | * ffe515d First commit for feature 1.
21 |/
22 * 228a1ab Added 'test1.txt'.
Notice how the commit 58df7c0
is displayed as if it is connected to the master
branch even though it was made in the feature2
branch, and commits 77a551a
to 682a2ab
are displayed as nested off the master
branch rather than feature2
.
Does this look like a bug with git log --graph
?