Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use git graph in vs code?

I am doing a git course and the git graph extension has been recommended to me. To my colleagues, the extension shows a graph with the different branches as follows:

git_grapg1

But to me all the branches appear in the same line:

git_graph2

I don't understand what I'm doing wrong or how to use the extension. Thank you very much.

like image 794
Diego L Avatar asked May 25 '26 17:05

Diego L


2 Answers

you can use the --graph option

git log --oneline --all --graph

in vs code you can install the extension : enter image description here

there are two ways to merge:

  • fast forward merge: linear graph
  • three-way merge: commit has diverged from the master

try to use this command when you need to merge the branch in the master => disable fast forward (ff) merge:

git merge --no-ff newBranch
like image 94
Chady BAGHDADI Avatar answered May 27 '26 08:05

Chady BAGHDADI


Your colleagues' screen shows a real merge commit. Yours seems to be a fast-forward merge. Fast-forward merges are the default when the branches have not diverged. In that case, the branch label can simply be moved to match the other branch's label (i.e. fast-forwarded). Only when branches have diverged, Git must create a merge commit to reconcile the history of both branches.

like image 44
knittl Avatar answered May 27 '26 10:05

knittl



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!