What exactly does each line in the graph represent?

I work with a team of developers developing enterprise applications, and we have used source tree with Git for about half a year now. However, we still can't seem to figure out exactly what each line in the graph represents? Is each line one branch? If so, which color corresponds to which branch? Why is there no key?

2 answers

1 accepted

In general, each line is one branch. Keep in mind that working in a team environment will often create multiple branches with the same name (in the graph). For example, my repository's "master" is a different branch than my coworker's "master". As long as we are staying in sync, these will be displayed together, but if the two of us make commits simultaneously, someone has to merge, and the "master" branch will temporarily diverge to reflect that activity (unless the merger uses rebase, which rewrites their history to make it appear as if the branch did not diverge).

Colors are arbitrary, intended only as a visual aid when scrolling through the history. It seems that Sourcetree cycles through a fixed sequence of colors, starting with blue for the most recently touched branch.

I believe the reason this gets so confusing is because the distributed nature of Git makes a commits membership in any particular branch much more ambiguous that for a centralized system like SVN.

Just for completion:

Look at my comment here:

https://answers.atlassian.com/questions/310287/how-to-know-which-branch-color-correlates-with-which-branch

I tried to explain there, that the git-log view isn't static.

Is each line one branch? ... Why is there no key?

Yes - and no. You are able to delete branches in git - this means mainly that the branch name is deleted while the commits on the branch still remain. Within the git-log view the commits on the deleted branch are still represented on a separate line - unless the branch does not exist anymore. So each line represents an existing or (maybe) deleted branch - therefore there is no key for the lines (as the branch may be deleted).

What the gil-log view really represents is a topological view on the commits rather than a branch overview. It displays things like "the parent of commit x is commit w" (in case of straight development) or "commit a has two children: commit b and commit c" (in case of branching where commit b lives on branch 1 and commit c lives on branch 2) or "commit i has two parents" (in case of merges) ...

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Brian Ganninger
Published Jan 23, 2018 in Sourcetree

Tip from the team: workflow and keyboard shortcuts

Supported Platforms macOS Sourcetree has a lot to offer and, like many developer tools, finding and using it all can be a challenge, especially for a new user. Everyone might not love ...

797 views 0 4
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you