dibs_ab
dibs_ab

Reputation: 723

git pull already up to date but head is not detached

Reading the title I know you would be pretty shocked as in why I am sure about head not being detached. I am not very used to GIT. There has been a change in the original repo I have made my clone from named upstream. I am trying to pull those changes by git pull, which says, Already up to date. I did,

git branch -r

origin/HEAD -> origin/master
origin/master
upstream/branchName
upstream/master

So my head is at origin master, which I think is fine. And doing,

cat .git/HEAD

gives

ref: refs/heads/master

All over Stack I see people referring it to a detached head problem. But I think that's not the case with me.
I had done a git fetch upstream yesterday which showed me compressing files and everything. But when I opened the repo in my editor I dont see any new changes fetched.

Upvotes: 0

Views: 2084

Answers (1)

Tapio
Tapio

Reputation: 3456

git fetch fetches the commits but does not affect your HEAD position. You need to merge your local master with the upstream you want: git merge upstream/master (or git merge origin/master).

git pull normally does both git fetch and git merge for you, but it will abort if there is no new commits. Note that if you pull from other remotes like your upstream, you need to specify it, together with the branch to merge with: git pull upstream master

Upvotes: 3

Related Questions