My colleague has pushed to our git repository a mistake. I wish to commit some updated code, but I had not git pulled and as a result am 1 commit behind the HEAD. How can I ignore his changes completely and override his mistake if I am behind?
You can force a push like the other answer suggests, but a safer way is to go ahead and pull his changes, then git revert
his commit, which will completely undo all his changes. This doesn't run the risk of unintentionally losing changes:
git pull
git revert <treeish naming his commit>
git push
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With