I am working with a local repository and a repository on my server. The server branch should have the name "master" and the local branch I would like to name "local".
With git branch -a
I listed all my branches:
* master
remotes/origin/HEAD -> origin/master
remotes/origin/master
I guess that * master
here is the local repository I am actually working at the moment.
What I do not understand is, what is origin/HEAD ?
and why is it pointing to origin/master
?
Is origin/master
the same as master
? I am confused.
So as a result I think I would need only this:
* local
remotes/origin/master
CodePudding user response:
origin/HEAD
is the default branch of the remote repository with name origin
. You can usually ignore it.
To rename your local branch, run git branch -m local master
, git checkout master && git branch -m local
, or git checkout -f local master && git branch -d master
.
CodePudding user response:
Good evening!
You can look at .git directory and find there next path: .git/refs/remotes/origin/HEAD
You also can cat it:
cat .git/refs/remotes/origin/HEAD
ref: refs/remotes/origin/master
That means that remote HEAD refers to a remote master
jfyi You can also see where the local HEAD refers to
cat .git/HEAD
ref: refs/heads/master