I've a couple of repo's that contain a master and dev branch. Master represents releases while dev represents the current buildable version. There are also a number of other branches for features which are deleted after merging to dev.
I've recently changed to using the pull request workflow, before that, I performed squashed merges. Some repos are new and have always used the pull request workflow, however, one of the older repos (and most important) used the squashed merge. The revision graph looks like this
At this point, all changes have been committed and pull requests used to merge the changes. Ignoring customs and collections I'd expect a revision graph like this:
My questions are:
Is there anything wrong with the first revision graph?
How could I get the graph to be more like the second?
Git actually does have symbolic references, in which one reference contains the name of another reference, rather than its value.
Until relatively recently, these mostly didn't work,1 except for the specific case of
HEAD
. The mainHEAD
is normally a symbolic reference to some other branch name. Thegit checkout
command, or the newgit switch
in Git 2.23 and newer, manages this symbolic reference for you.Meanwhile, reach remote, such as
origin
can have a symbolic HEAD, e.g.,origin/HEAD -> origin/master
. Your Git sets these up based on the results it gets when it asks the Git at the URL—theorigin
Git in this case—what branch itsHEAD
named. If theirHEAD
was a symbolic reference to theirmaster
, yourorigin/HEAD
should be a symbolic reference to yourorigin/master
.But apart from these cases, each reference just holds a raw hash ID. The best2 way to draw this is to draw the reference holding the hash ID, or pointing to the Git object selected by that hash ID. Only symbolic references should be drawn as pointing to another reference.
1Try creating symbolic branch
sym
containing just-created branch namebr
:List the branches with
git branch
to make sure it worked. Now ask Git to delete branchsym
:Old versions of Git would delete branch
br
! If your Git deletedsym
, you have a Git in which these symbolic refs work better.2Best is, of course, a matter of opinion, but since I'm writing this answer, I get to use my opinion. :-)