Undo last commit (keep changes)
Move HEAD back one commit, keeping staged changes
git reset --soft HEAD~1
- tool
- git45 commands
More git commands
-
git clean -fdRemove untracked files and directories from working tree
-
git branch --merged mainList local branches already merged into main
-
git rebase -i HEAD~5Squash, reorder, or edit the last 5 commits
-
git cherry-pick <sha>Apply a single commit from another branch
-
git reflog show --date=relative | head -20Show recent HEAD movements including rebases and resets