0

I had accidentally committed and pushed modifications to some files to a branch on bitbucket. When I wanted to remove these files from the commit I used the rm command and ended up deleting the files. What I am trying to say is, I ended up deleting the files instead of removing the modifications on them. I tried using git reset but that only resets my latest commit, while the wrong commit/push was several points backwards. Any ideas?

Prathik
  • 474
  • 3
  • 13
  • Possible duplicate of [Resetting remote to a certain commit](https://stackoverflow.com/questions/5816688/resetting-remote-to-a-certain-commit) – Bonje Fir Dec 03 '17 at 11:27
  • Possible duplicate of [Git - Undo pushed commits](https://stackoverflow.com/questions/22682870/git-undo-pushed-commits) – Oliver Charlesworth Dec 03 '17 at 11:30

1 Answers1

-1

You need to execute following commands:

(if there are no changes, that were submitted after your push) 1. Reset your changes: git reset --hard 2. Update origin: git push origin -f (it will force push your changes).

Leonid
  • 1,071
  • 2
  • 15
  • 27