how to remove/change last pushed commit

heykush

Gaurav kushwaha

Posted on July 2, 2022

how to remove/change last pushed commit

Steps to remove/changes in last pushed commit

  1. Get the commit id on which you want to go
git log
Enter fullscreen mode Exit fullscreen mode
  1. Reset on that commit and this will unstage all the changes
git reset <commit id>
Enter fullscreen mode Exit fullscreen mode
  1. Now do changes in unstaged files
  2. To push changes in branch, you have to force push this time
git push origin <branch name> -f
Enter fullscreen mode Exit fullscreen mode
  1. If you removed the commit, it also removed from server too.

That's how you can do changes even after doing commit

đź’– đź’Ş đź™… đźš©
heykush
Gaurav kushwaha

Posted on July 2, 2022

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related