DEV Community

Cover image for how to remove/change last pushed commit
Gaurav kushwaha
Gaurav kushwaha

Posted on • Updated on

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

Discussion (0)