Whenever I checkout at the master branch and execute git pull
it returns:
fatal: bad object refs/heads/1477/feature-client-custom-query 2
The same fatal returns when I run git gc
I have the branch 1477/feature-client-custom-query
locally and have pushed all its commits to origin. I'm not sure why it has the 2
at the end of the fatal message. My objective is to get my local copy of master in sync with origin. As of now, it is several commits behind.
When I execute git reset --hard origin/master
it returns:
HEAD is now at 3be1bd5dc0 commit message
But this is not the most recent commit in origin/master. How can I get the head up to date on my local copy?
CodePudding user response:
You can pull all changes with rebase
git pull --rebase origin master
- Then solve the conflicts
git add <file_name> OR git add .
git rebase --continue
- if you still the conflicts then repeat 2nd to 4th steps
OR you can directly do with force pull
git pull -f origin master
CodePudding user response:
I have the branch
1477/feature-client-custom-query
locally and have pushed all its commits to origin. I'm not sure why it has the2
at the end of the fatal message.
This is one of the symptoms displayed for a Git repository that has been damaged by cloud-synchronizing software such as OneDrive, iCloud, Dropbox, etc. (Don't store Git repositories here as they will get damaged. Via Murphy's Law, this usually happens right before the big demo.)
To fix it, you can probably (1) move the repository out to a safe location, then (2) remove the .git/refs/heads/1477/feature-client-custom-query 2
file that the cloud-syncing software created. Run git fsck
to check everything else. If it's too heavily damaged, just remove it and re-clone.