Skip to content

Latest commit

 

History

History
34 lines (22 loc) · 603 Bytes

HowTo - Git Undo.md

File metadata and controls

34 lines (22 loc) · 603 Bytes

HowTo - Git Undo

REF.: Git - git-reset Documentation
REF.: Git - git-commit Documentation

Note: Undo is NOT a git command! It is just referring to help undoing things while using git.


Undo Last Commit

git reset --soft HEAD^

Undo Until Specific Commit

git reset --soft <hash>

Note: HEAD^ goes 1 step back, HEAD^^/HEAD~2 goes 2 steps back, etc.

Delete Last Commit

git reset --hard HEAD^

Add Files to Last Commit

git commit --amend