>git branch -a
* master
remotes/origin/HEAD -> origin/master
remotes/origin/master
Are they both same, if yes then why do we have two.
If master
is checked out, then HEAD
is master
. That is not the case if another branch (or simply a commit) is checked out - as HEAD is a reference to the current commit you're on.
Example:
git checkout wip
# Then HEAD == wip
git checkout aed24d
# Then HEAD == aed24d
HEAD is a comvenience. It's a helper/shortcut.
It's frequently pointed at origin/master but it can also point to another branches commit.