5

Our team is new to git (we are more an svn shop). We are trying to figure out the concepts, but sometimes we see odd results.

For example, here is a screenshot from GitKraken :

Git Kraken Screenshot

The blue line is the master branch, why is there a gap here? Which git command could reproduce this and is there any problem doing this?

Leif Gruenwoldt
  • 13,561
  • 5
  • 60
  • 64
remi bourgarel
  • 9,231
  • 4
  • 40
  • 73
  • 1
    Possible duplicate of [What exactly do we mean by "branch"?](http://stackoverflow.com/questions/25068543/what-exactly-do-we-mean-by-branch) – mkrieger1 Mar 06 '17 at 13:11
  • 1
    @mkrieger1 maybe it's a duplicate because we don't fully understand what is a branch, but can you explain us what we understood wrong – remi bourgarel Mar 06 '17 at 13:24

2 Answers2

5

The lines and their colors do not directly correspond to branches. A branch is just a pointer to a commit. The link in mkrieger1s answer discusses this in detail.

Your graph is perfectly fine, you're just reading/interpreting it wrong. Each big dot (with an avatar on it) is a commit, each commit has exactly one parent commit. Each small dot is a merge commit, each of which has exactly two parents.

The big knot in the middle is a merge commit with two parent commits (the lines that reach the knot from below); the merge commit itself is parent for three more commits (those that are above the merge itself).

You see this in every graphical representation of git repositories, and it's perfectly fine.

kowsky
  • 12,647
  • 2
  • 28
  • 41
2

The blue line is not your master branch. A commit does not belong to any particular branch. In Git your history is a DAG (directed acyclic graph). Branches and tags are just post-it notes stuck to any commit you like and as with real post-it notes you can peel off the branch or tag marker and stick it to any other commit you like (not necessarily the best idea with already pushed history, but perfectly legal with purely local stuff). The only difference between a branch post-it and a tag post-it is, that the branch post-it is automatically moved to the new commit if you have checked out the branch (really the branch, not just the commit the branch points to, there could multiple branch post-its point to the same commit) and create a new commit.

So if the upper left light blue line is part of your master branch, so are the two red commits (but not newer ones above the image) and also the pink commit in the lower right and the light and dark blue commits in the lower left.

Vampire
  • 35,631
  • 4
  • 76
  • 102