In the commits view panel of Source Tree, how can you view exactly on what branch it's a commit? I can see the different color lines from the left but it is not clear at all which is associated with that commit and what is the name of the branch associated with the line.
I really think something as enbling display of the branch name before the commit message would help.
In git, branches are never an attribute of a commit, they're simply pointers to a single commit which move as you commit to that branch, so the history is built by association via the parent links, and each commit has no branch information associated with it. This means moving branches around is very easy in Git, which is one of its strengths, although it can be confusing not to see an explicit branch in the commit metadata like you're used to in other systems. Technically the graph lines are just ancestry lines, not branch lines (although often the two are aligned).
In contrast, Mercurial does store branch information on every commit, so it's displayed in the commit details pane. This can be somewhat more intuitive than the Git way, but also not as flexible.
This means it's not doable?
I consider myself a beginner in Git so you are most likely right but what I don't get is the line colors from the left .. if they are associated with branches (as I imagine) I thought it should be possible .. but again maybe I misunderstood the lines role :)
If yes, let me know and I'll accept the answer.
No, it's not possible to label a commit with a branch, because every commit could be in the history of more than one branch in git.
The graph lines are associated with 'lines of development', which means each commit has one or more ancestors, the first one of which will normally considered the main ancestor and will have the same colour. In git, a branch is just a pointer to an end point, so you can follow a branch backwards from where it points to see its own history, and call the line which follows the first parent of each commit the 'branch line' if you want, but technically that's not what it is - the branch is just the end point, the rest is just a graph of ancestry for how you got there. Each commit itself is not assigned to a branch, it just happens to be in the parentage of where the branch points.
This is probably one of the trickiest things to grasp in git since it differs from almost every other VCS in not marking commits with a branch when the commit is made, but having branches as pointers (which can be changed of course!) instead.
Badges are a great way to show off community activity, whether you’re a newbie or a Champion.Learn more
Supported Platforms macOS Windows To make using Sourcetree as simple yet powerful as possible we embed (bundle) dependencies such as Git, Git LFS, and Mercurial. We strive to keep these...
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!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG