Skip to content

Latest commit

 

History

History
26 lines (18 loc) · 546 Bytes

2-git-reset.md

File metadata and controls

26 lines (18 loc) · 546 Bytes

git reset

Reference docs

In the first and second form, copy entries from to the index. In the third form, set the current branch head (HEAD) to , optionally modifying index and working tree to match. The / defaults to HEAD in all forms.

Modes of reset

git reset --soft HEAD~2
git reset HEAD~
git reset --hard <commit-SHA>

Removing items from the staging area

git reset -- <filename>

Reset across merge commits

git reset --hard HEAD~^
git reset --hard HEAD~^2