Undo last commit keep changes
Move HEAD back one commit; staged changes return to working tree
git reset HEAD~1
More git commands
-
git restore . && git clean -fdReset tracked files and remove untracked files/directories
-
git tag -l -n1List all tags with their first annotation line
-
git tag -s v1.2.3 -m 'Release 1.2.3'GPG-signed annotated tag for releases
-
git fetch --pruneRemove local refs to remote branches that no longer exist
-
git clone --depth=1 --single-branch --branch main <url>Clone only the latest commit of one branch (fast CI checkout)