DEV Community

Discussion on: How to undo the last commit

Collapse
 
lt0mm profile image
Tom • Edited

also a really powerful command is interactive rebase, though also it changes history for example

git rebase -i HEAD~3
Enter fullscreen mode Exit fullscreen mode

it means you want to make changes in last 3 commits, you can squash them, delete them, change messages, by the way I use it a lot in my feature branches even when I already pushed some commits then I do forced push to rewrite history on the server, it is ok till I know that only I work on that branch