gitgraph.js
gitgraph.js copied to clipboard
Orphan Branch
It seems like the ability to create an orphanBranch was removed in v2. Could this be added back? See this previous issue regarding orphan branches from v1:
https://github.com/nicoespeon/gitgraph.js/issues/23
Indeed, we forgot about this feature. Thanks for flagging @tfinelli 👍
To simulate a orphan branch or a branch that "already" exist I use a workaround and delete the parentCommitHash and give the branch a special commit object.
I'm currently use the gitgraph-js.
const cutTimeline = {
renderMessage: function() {
return document.createElement('text');
},
renderDot: function() {
return document.createElement('circle');
},
};
const master = gitGraph.branch({
...branchTypeConfigs.master,
});
master.commit(cutTimeline);
const develop = master.branch({
...branchTypeConfigs.develop,
});
delete develop._branch.parentCommitHash;
develop.commit(cutTimeline);
Thank you @NonPolynomial that gave me 90% of what I wanted.
I now have a diagram that looks like this:

Is there any way to extend the blue line (my develop branch) down so that it begins at the same place as the grey branch (my master branch)?
@nadcraker
Is there any way to extend the blue line (my develop branch) down so that it begins at the same place as the grey branch (my master branch)?
tl;dr: nope, it depends on the order how and when your commits are added to the workflow
I think I tried everything, but never get to work that two branches start at the same "time" because the graph depends on "when" a commit was made (added to a branch).
to make your branch longer, you could make another commit, but it won't be as long as your master branch
@NonPolynomial so two branches may not start from one commit? I just tried to import, and it's ok...
Does the problem only occur with orphan branches?
@NonPolynomial so two branches may not start from one commit? I just tried to import, and it's ok...
Does the problem only occur with orphan branches?
The issue was just about orphan branches. but this issue is 3 yrs old. Don't exactly know if that still is the case in the latest version.
You should be able to create x branches from a previous commit. You just cant add orphan commits that appear at the same "time" in the graph