Skip to content

Instantly share code, notes, and snippets.

@milki
Created February 27, 2016 09:09
Show Gist options
  • Save milki/012841b1ef953d09b776 to your computer and use it in GitHub Desktop.
Save milki/012841b1ef953d09b776 to your computer and use it in GitHub Desktop.
git reset HEAD --hard
milki@dashi:/tmp/docu$ touch a; git add a; git status
On branch master
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
new file: a
milki@dashi:/tmp/docu$ git reset HEAD --hard; git status
HEAD is now at 49c9f9d init
On branch master
nothing to commit, working directory clean
@milki
Copy link
Author

milki commented Feb 27, 2016

milki@dashi:/tmp/docu$ touch a; git add a; git status
On branch master
Changes to be committed:
(use "git reset HEAD ..." to unstage)

new file:   a

soft reset:

milki@dashi:/tmp/docu$ git reset HEAD; git status
On branch master
Untracked files:
(use "git add ..." to include in what will be committed)

a

nothing added to commit but untracked files present (use "git add" to track)

@milki
Copy link
Author

milki commented Feb 27, 2016

milki@dashi:/tmp/docu$ git --version
git version 2.6.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment