0

This is what I have done:

git commit -m 'feature 1 implemented'
git push origin feature-branch

..few days later

git commit --amend --no-edit 
git push -f origin feature-branch

And then I realised that feature branch have contained commits pushed by others which I just screw up because I forgot to git pull

As I understood from another questions git push --force can be easily undone

  • if you have working local copy
  • if you can get the commit sha

But in my case I don't know these details, I have rewritten others commits

I know I can ask my teammembers to force update without pulling, but still

Is there a way to undo --force push and git pull this data ?

vickk
  • 119
  • 1
  • 9
  • Usage of push with forse option is not good idea in case if branch is using by more then one developer. – Ivan M. Jan 15 '16 at 19:46

1 Answers1

0

just found the solution here How to recover from a git push -force?

All I needed was

git reset --hard origin/feature-branch@{1}

(I could see the missing commints in git status)

git push -f origin feature-branch
Community
  • 1
  • 1
vickk
  • 119
  • 1
  • 9