Reputation: 1168
I need to reset the origin/branch
to 2 commits back:
a---b---c[head]---d---e[origin/branch]
to
a---b---c[head, origin/branch]
However I can't force push to this branch as it is protected on github.
What is the procedure to basically erase the last two commits from remote (github)?
Upvotes: 2
Views: 1298
Reputation: 13276
A force push is the only way to remove commits. However you can create a new commit that undoes what what changed in previous commits using git revert
.
In your case, to undo the changes from commits d
and e
, you would do
git revert d e
Then you just need to commit the changes and push to origin.
Upvotes: 4