I have a problem with a git repo that is shared between multiple developers. A branch seems to have gone missing (kind of) and when I try to push to the remote repo with this branch I receive the following message...
To git@hades:bbis.git
* [new branch] dompdf0.52 -> dompdf0.52
! [rejected] live -> live (non-fast-forward)
error: failed to push some refs to 'git@hades:bbis.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again. See the
'Note about fast-forwards' section of 'git push --help' for details.
There are 3 branches on the repo:
- dompdf0.52 is a temp branch where I upgraded the dompdf (this is okay)
- master
- live (this is the problematic branch)
I am the only developer who uses the live branch (used for deploying to the live server), and I did some work directly in this branch (not a good idea I know, but this was a mistake) and committed locally. I get this error when I try to push.
Other developers have no visibility of the live
branch or dompdf0.5.2
branch (I created both of these, but have pushed them to the remote repo - they even show up in the gitweb interface as HEADS). Even when developers do a git pull --all
it still doesn't pull these branches down.
Another strange phenomenon is that when viewing the log on gitweb it only shows the master
, but when looking at the shortlogs for live
branch it shows live
at the same point where the master
is in the master
shortlog.
I'm just a little confused as to what is going on here, from what I can see the live
branch is in the remote repo but not showing in the main repo log.
Has anyone got any ideas? Let me know if you need any images from gitk
EDIT: Just thought I'd mention, I've tried to work around the error message by doing a git fetch
and a git pull
but to no avail. The only thing I've not tried is a git push --force
because I don't want to lose my history.
EDIT 2: After running the script that sehe provided I received the following:
fatal: ref ed2cacdacad22c75ca765cfc996304c8c7c8a654 is not a symbolic ref
fatal: ref 98c37bd8a9ef2fc16e882c17b4c04f417ae7b2b2 is not a symbolic ref