8

Visualization and understanding of a fast turn in git

 3 years ago
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.
neoserver,ios ssh client

Visualization and understanding of a fast turn in git

advertisements

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:

  1. that HEAD is behind the corresponding remote-tracking-branch (origin/<branch_name>).

  2. 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)


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK