Vscode-git-graph: New branch line on graph?

Created on 4 Dec 2019  路  3Comments  路  Source: mhutchie/vscode-git-graph

Hello

_In fact, I'm still learning to work with git, so I'm not sure this question is justified, but I'll try_

I don't understand why after creating a new branch and several commits, there is no new line in the graph
It's hard to explain, so I'll try to show it in the picture below

Here's how it is now:
obraz

Here's how I expect it:
obraz

I created new branch with command:
git checkout -b newbranch

My VSCode:

Version: 1.40.2 (system setup)
Commit: f359dd69833dd8800b54d458f6d37ab7c78df520
Date: 2019-11-25T14:54:45.096Z
Electron: 6.1.5
Chrome: 76.0.3809.146
Node.js: 12.4.0
V8: 7.6.303.31-electron.0
OS: Windows_NT x64 10.0.18363
question

Most helpful comment

Thank you all for the thorough explanation! 馃枻

All 3 comments

Commits have to be in a list, the branch lines describe how they relate to each other as best they can.

This means that some branches appear in line with each other simply because the commits were in that order and there was no other information to force a new line to be created.

If you checked out the master branch and made another commit directly to it, or had some uncommitted changes, you would see the branch lines change to match what you expect would happen.

Here is a slightly complicated example from one of my repos:
image

Even though you've created newbranch and made commits on it, it is shown in the graph straight above the master branch as the master branch has no new commits on it (and stops where the master label is). In your example there is only one line of history in the repository (even though there are two branches), one line of history = one column in the graph with one colour.

The graph will only use multiple columns once a commit has two children (each having there own line of history).

Based on your example:
image

If a new commit is created on the master branch, a second column & colour will be used as third commit now has two children with separate lines of history:
image

If newbranch was merged back into master, an new commit is also created on the master branch (so a second column & colour will also be used):
image

I hope this helps to answer your question. Please reply with follow up questions if you have any.

Thanks Will for assisting with answering this question!

Thank you all for the thorough explanation! 馃枻

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kimyvgy picture kimyvgy  路  7Comments

ackvf picture ackvf  路  7Comments

Konsonanz picture Konsonanz  路  4Comments

umairkhan-dev picture umairkhan-dev  路  5Comments

morganlombard picture morganlombard  路  5Comments