Skip to content

Commit 96186d0

Browse files
randomechoAndrew Dailey
authored andcommitted
git reset does not affect commit, but changes index, stage to them
Clear up what happens when you run `git reset` in that it does not affect the commit, or allow to change it per se, but that it affects what is sitting in the index and staging as pointed to by the commit or HEAD pointer mentioned. Fixes #63
1 parent 9cdec2f commit 96186d0

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

basic/index.html

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ <h2>
612612

613613
<h4>
614614
git reset HEAD
615-
<small>undo the last commit and unstage the files</small>
615+
<small>unstage files from index and reset pointer to HEAD</small>
616616
</h4>
617617

618618
<p>First, you can use it to unstage something that has been
@@ -691,7 +691,7 @@ <h4>
691691

692692
<h4>
693693
git reset --soft
694-
<small>undo the last commit</small>
694+
<small>moves what HEAD points to, index and staging are untouched</small>
695695
</h4>
696696

697697
<p>The first thing <code>git reset</code> does is undo the last
@@ -721,11 +721,12 @@ <h4>
721721

722722
<h4>
723723
git reset --hard
724-
<small>undo the last commit, unstage files AND undo any changes in the working directory</small>
724+
<small>unstage files AND undo any changes in the working directory since last commit</small>
725725
</h4>
726726

727727
<p>The third option is to go <code>--hard</code> and make your working
728-
directory look like the index, unstage files and undo the last commit.
728+
directory look like the index, unstage files and undo any changes made
729+
since the last commit.
729730
This is the most dangerous option and not working directory safe. Any
730731
changes not in the index or have not been commited will be lost.</p>
731732

@@ -752,7 +753,8 @@ <h4>
752753

753754
<p>In the above example, while we had both changes ready to commit and
754755
ready to stage, a <code>git reset --hard</code> wiped them out.
755-
On top of that, the last commit has been undone.</p>
756+
The working tree and stage are now reset to the point just after the
757+
commit pointed at by HEAD.</p>
756758

757759
<p>You can replace <code>HEAD</code> with a commit SHA-1 or another
758760
parent reference to reset to that specific point.</p>

0 commit comments

Comments
 (0)