

Visualization and understanding of a fast turn in git
source link: https://www.codesd.com/item/visualization-and-understanding-of-a-fast-turn-in-git.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Visualization and understanding of a fast turn in git
I just fetched from origin and git status
reports:
Your branch is behind origin/ by 13 commits, and can be fast-forwarded
Strictly speaking, what does this exactly mean? Does it mean:
that
HEAD
is behind the corresponding remote-tracking-branch (origin/<branch_name>
).or that
<branch_name>
is behind the corresponding remote-tracking-branch (origin/<branch_name>
)?
What if I am on a detached HEAD
? (i.e. if my HEAD
and <branch_name>
don't point to the same commit).
Is there a way to visualize these pointers (HEAD
, <branch_name>
and origin/<branch_name>
on a graph? I have tried with git log --graph
, but I think I only see the different commits and they merge overtime.
Let's look at an example. This repository has a remote called origin
with a branch called master
. I also have a branch called master
which I currently have checked out.
% git log --decorate --graph --pretty=oneline --abbrev-commit --all
* 072a57a (origin/master, origin/HEAD) C
* 87011c4 B
* d3c4a48 (HEAD, master) A
When I run git status
it tells me that my branch master
is behind origin/master
by two commits.
% git status
# On branch master
# Your branch is behind 'origin/master' by 2 commits, and can be fast-forwarded.
#
nothing to commit (working directory clean)
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK