Git: Delete a commit in a remote branch

For latest commit:
  1. git reset --hard HEAD~1 / git reset --hard
  2. git push origin HEAD --force
For old commits:
  1. git rebase -i
  2. Change pick to drop for commits which you want to delete.
  3. Maybe resolve conflict and continue rebase
  4. Change a new message commit
  5. git push --force

Comments

Popular posts from this blog

Logout Git on MacOS

Login/Logout account Git in Terminal/cmd

React Tutorial for Beginners