3

I am a relatively newbie to GIT and having issues understanding Commit Log graph.

I am under the feeling that each parallel line is a branch.While my source has only 2 branches..I see 3-4 parallel lines in the commit log graph provided below(Microsoft Team Services).Can someone help me understanding this?

enter image description here

raj'sCubicle
  • 350
  • 2
  • 13
  • Those connections aren't branches, just references to one or more parent commits. Branches are just pointers/labels to specific commit references. – evolutionxbox Dec 05 '17 at 14:47
  • Tags are pointers to specific commits, a branch _name_ describes commit which is currently the _end_ of the branch. – scrutari Dec 05 '17 at 18:57

2 Answers2

2

Correct. Each parallel line is a branch.

In the example image that you gave above those 7-character strings are (short versions of) commit IDs.

For ease of explaining I am going to include this graph (below) that I found online; particularly because it shows the order of the commits, the first commit, and the last commit.

enter image description here

Listing of the branches

In this graph there are four branches. They are:

  1. master branch (represented by the purple dots)

  2. next branch (represented by the green dots)

  3. feature-1 branch (represented by the pink dots)

  4. and feature-2 branch (represented by the orange dots)

The line between commit ID 1b43a59 and commit ID 2b59872, and including commit ID 5f357ab and commit ID 3c5bf63, is the master branch.

The line between commit ID 1b43a59 and commit ID 1ce9df1, and including commit ID dff00dd, is the next branch.

The line between commit ID 1b43a59 and commit ID 5f357ab, and including commit ID 9ffab9f and commit ID 9db9694, is the feature-1 branch.

The line between commit ID 1b43a59 and commit ID 3c5bf63, and including commit ID 54a16ed and commit ID 813c45b, is the feature-2 branch.

Listing of the merges

The feature-1 branch is merged into the next branch at the commit represented by commit ID dff00dd.

The feature-1 branch is merged into the master branch at the commit represented by commit ID 5f357ab.

The feature-2 branchis merged into the master branch at the commit represented by commit ID 3c5bf63.

The feature-2 branchis merged into the next branch at the commit represented by commit ID 1ce9df1.

The next branch is not merged into anything.

Jamie Bort
  • 121
  • 1
  • 8
1

In git, branches are names of so called "heads" – they are related to the top most commits (which – in a simple case – do not have any further, or child, commits). In your case currently you have one branch, but previously there were 4 branches (at the moment of 4e31eddd), then 3 branches (d9effc23), and so on until it became one branch at 09d65a15.

However, even if a branch is merged into another branch it can still be a "head".

scrutari
  • 1,378
  • 2
  • 17
  • 33
  • Is there a command where I can get to know the name of those branches.? – raj'sCubicle Dec 04 '17 at 19:49
  • A `git branch -a` shows you all current branches both existing locally and remotely. – scrutari Dec 05 '17 at 08:10
  • Are all branches "heads"? – evolutionxbox Dec 05 '17 at 14:48
  • Yes, more precisely: branch names are pointers to branches ends or "heads". More details can be found: https://stackoverflow.com/questions/8196544/what-are-the-git-concepts-of-head-master-origin and https://stackoverflow.com/questions/4386959/difference-between-head-and-master. – scrutari Dec 05 '17 at 18:58