From 96186d05ff119871376ee81f80d9a8ef0e3c0c5a Mon Sep 17 00:00:00 2001
From: Soon Van First, you can use it to unstage something that has been
@@ -691,7 +691,7 @@ M hello.rb
The first thing The third option is to go In the above example, while we had both changes ready to commit and
ready to stage, a
git reset HEAD
- undo the last commit and unstage the files
+ unstage files from index and reset pointer to HEAD
git reset --soft
- undo the last commit
+ moves what HEAD points to, index and staging are untouched
git reset
does is undo the last
@@ -721,11 +721,12 @@ nothing to commit (working directory clean)
git reset --hard
- undo the last commit, unstage files AND undo any changes in the working directory
+ unstage files AND undo any changes in the working directory since last commit
--hard
and make your working
- directory look like the index, unstage files and undo the last commit.
+ directory look like the index, unstage files and undo any changes made
+ since the last commit.
This is the most dangerous option and not working directory safe. Any
changes not in the index or have not been commited will be lost.git reset --hard
wiped them out.
- On top of that, the last commit has been undone.
You can replace HEAD
with a commit SHA-1 or another
parent reference to reset to that specific point.
The first thing git reset
does is undo the last
@@ -753,8 +753,8 @@ nothing to commit (working directory clean)
In the above example, while we had both changes ready to commit and
ready to stage, a git reset --hard
wiped them out.
- The working tree and stage are now reset to the point just after the
- commit pointed at by HEAD.
You can replace HEAD
with a commit SHA-1 or another
parent reference to reset to that specific point.