Possible Duplicate:
HEAD and ORIG_HEAD in Git
By default we see two branches in git:
origin/master
origin/HEAD
I wonder, what is head used for?
Possible Duplicate:
HEAD and ORIG_HEAD in Git
By default we see two branches in git:
origin/master
origin/HEAD
I wonder, what is head used for?
It's a pointer to the current commit.
Since it represents a commit you can can use it with most of git's commands.
Show the latest commit with it's diff:
git show HEAD
Interactively rebase to the commit before the latest:
git rebase -i HEAD^
HEAD
is a a symbolic reference (similar to a symbolic link) that points to the branch you're on. You can get the reference it points to using git symbolic-ref HEAD
. If you switch branches (e.g. git checkout branch1
), HEAD
will point to that. This is stored in a file in .git
as .git/HEAD
.
master
is a local branch that you can work on. It's usually the default if you clone a repository or start a fresh one.
origin/master
is the location of the master
branch on the remote
called origin
.