One commit can't serve as a parent to multiple merge commits (> 2)
See original GitHub issueThis example is very close to what I would like to diagram-
{(gitgraph) => {
const develop = gitgraph.branch("develop").commit();
const fix = gitgraph.branch("feature");
const release = gitgraph.branch("release");
fix.commit("Bug fixed.");
release.merge(fix);
develop.merge(release, "Bugfixes are always merged back to develop.");
}}

However, with a little bit of mspaint-

This seems to be impossible to build in gitgraph. I would expect the following code to work, but it breaks horribly.
{(gitgraph) => {
const develop = gitgraph.branch("develop").commit();
const fix = gitgraph.branch("feature");
const release = gitgraph.branch("release");
fix.commit("Bug fixed.");
release.merge(fix);
develop.merge(fix, "Bugfixes are always merged back to develop.");
}}
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Can a git commit have more than 2 parents?
A merge of more than one branch (i.e. a commit with more than two parents) is colloquially known as an "octopus merge". That's...
Read more >git - Merge commit first and second parents - Stack Overflow
A commit can have more than 2 parents, which is the result of merging 2 or more branches to one branch at the...
Read more >How to Revert a Merge Commit Already Pushed to ... - W3docs
On this page, you will find a short tutorial on how to revert a merge commit that is already pushed to the remote...
Read more >Cherry-pick changes - GitLab Docs
In Git, cherry-picking is taking a single commit from one branch and adding it as the latest commit on another branch. The rest...
Read more >Does a merge commit really need two parents? - Quora
Merge uses the difference between the head commits of the branches being merged. Rebase, on the other hand, has to replay every commit...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@nicoespeon Actually, it seems like this issue might not be completely resolved. The case of two child merges does indeed work, but the case of three child merges does not.
Here’s the 2 case working fine:
And here’s the 3 case looking slightly off:
Notice that in the 3 case, the green-to-grey merge is rendered as coming from the orange merge commit for some reason.
Indeed, that’s interesting. Thanks for adding more details, we’ll look into this 👍