ZANARDI Bruno

Software Developper

About
Resume

Git Blog

Git command `reset`

Definition

Reset current HEAD to the specified state.

Basic usage

Unstage a file

$ git reset HEAD <file>

Cleanup the stage

$ git reset HEAD

Advanced usage

Remove parts of changes in file content from index. Parts are selected interactively within hunks of changes generated by git

$ git reset -p HEAD <file>

Come back to previous commit

$ git reset --soft HEAD^