Undo last commit and keep changes staged
Move HEAD back one commit. Your changes stay staged
git reset --soft HEAD~1
- tool
- git45 commands
More git commands
-
git clean -fdDelete untracked files and directories from the working tree. Ignored files stay
-
git branch --merged mainList local branches already merged into main. These are safe to delete
-
git rebase -i HEAD~5Squash, reorder, or edit the last 5 commits
-
git cherry-pick <sha>Apply one commit from another branch to the current one
-
git reflog show --date=relative | head -20Show the last 20 HEAD moves, including that rebase you regret