DEV Community

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

Posted on • Edited on

1 1

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

Top comments (0)

AWS GenAI LIVE image

Real challenges. Real solutions. Real talk.

From technical discussions to philosophical debates, AWS and AWS Partners examine the impact and evolution of gen AI.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay