[RESOLVED] Git Pull Error : Fetch updated the current branch head - DevDummy

Latest

Views | Thoughts | Concepts | Techniques

Monday, August 13, 2018

[RESOLVED] Git Pull Error : Fetch updated the current branch head


Git pull request failed when the remote current branch head is different from the local.

$ git pull

remote: Counting objects: 9115, done.
remote: Compressing objects: 100% (46/46), done.
remote: Total 9115 (delta 769), reused 782 (delta 760), pack-reused 8306
Receiving objects: 100% (9115/9115), 52.37 MiB | 1.40 MiB/s, done.
Resolving deltas: 100% (3421/3421), completed with 265 local objects.

warning: fetch updated the current branch head.
fast-forwarding your working tree from
......
......

Please move or remove them before you merge.
Aborting
fatal: Cannot fast-forward your working tree.

After making sure that you saved anything precious from
$ git diff <hash>
output, run
$ git reset --hard
to recover.

Solution

In such a scenario, it is required to back up the local changes, revert the changes and execute a hard reset.

$ git reset --hard

HEAD is now at 1f4312$$$ Merge pull request ### from #######

$ git pull

Updating 1f4312$$$..46daf4$$$
Fast-forward


No comments:

Post a Comment