Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to understand the graph output of `git log --all --graph --oneline --decorate`?

Tags:

git

When running git log --all --graph --oneline --decorate, what do the text in parentheses following commit names mean?

For example

enter image description here

What do the colors (blue, green, red, and yellow) used to colorize the strings mean respectively? Any other colors that can be used but not shown here?

What does -> mean?

What does / between origin and either B... or staging mean?

In the first line of the output,

  • does HEAD -> B... mean the HEAD of branch B... points to the commit?
  • What does origin/B... mean?

In the 5th line of the output

  • does tag: 1... mean something similar to HEAD -> B... in the first line?
  • what staging in green mean?
  • What does it have three strings separated by comma in this line, while only two in the first line?

In the 6th line of the output

  • Why is there only one string here, less than the first and 5th line?

Thanks.

like image 905
Tim Avatar asked Mar 10 '23 07:03

Tim


2 Answers

Its a huge amount of questions ^_^.

parenthesis

Text in parenthesis indicates tags, branches and HEAD pointer if present and if your working directory is here. You change your HEAD pointer (your working) every time you run git checkout SOMETHING where something is a tag, a branch or just a commit hash.

colors

The color depend on your terminal configuration I've these colors:

  • purple for stashes
  • red for remote branches
  • white bold for local branches and tags
  • yellow for commit messages

in your image I see

  • red for remote branches
  • red for local branches
  • yellow bold for tags
  • yellow for commit hashes

->

Is just a pointer. HEAD -> 45g24g42t indicates that your HEAD (your working directory is on commit 45g24g42t.

origin/bla

Every time you clone a project, for example you can see this:

* 3G245GV (HEAD -> 3G245GV, foo, origin/foo)

This means that your local branch foo is in the same point of your remote foo branch. Generally remotes are named origin. If you make a commit you can see in your computer something like this:

* G54G23F (HEAD -> G54G23F, foo)
* 3G245GV (origin/foo)

This means that your local branch is ahead from origin/foo. This means you should push your commits.

Thats all

Some questions are redundant, but I'll improve this answer if necessary.

like image 72
sensorario Avatar answered Apr 28 '23 06:04

sensorario


In git a branch is basically a pointer to a commit.HEAD is also a pointer which points to the current branch on which you have checked out.

So HEAD -> B03701 simply means that currently you are on B03701 branch.So -> indicates where your HEAD pointer is pointing

In the snapshot red colour is indicating your remote branches.Here origin/staging means that the staging branch on our remote is pointing to ee8f77d commit. Here origin simply indicates remote repository

Whereas colour green is indicating your local branches so staging in green is your local branch which was created by you and it is also pointing to ee8f77d which means that the last commit which you did when you were on the staging branch was ee8f77d

So inside parentheses ,text separated by commas represents where a pointer(branch is a pointer) is pointing.So there may be more than one pointer pointing to a particular commit or there may be 0.

like image 37
Akash Singh Avatar answered Apr 28 '23 05:04

Akash Singh