From 96186d05ff119871376ee81f80d9a8ef0e3c0c5a Mon Sep 17 00:00:00 2001 From: Soon Van Date: Tue, 21 May 2013 22:06:56 -0400 Subject: 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 --- basic/index.html | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/basic/index.html b/basic/index.html index 0904da9..100c11d 100644 --- a/basic/index.html +++ b/basic/index.html @@ -612,7 +612,7 @@ Further paragraphs come after blank lines.

git reset HEAD - undo the last commit and unstage the files + unstage files from index and reset pointer to HEAD

First, you can use it to unstage something that has been @@ -691,7 +691,7 @@ M hello.rb

git reset --soft - undo the last commit + moves what HEAD points to, index and staging are untouched

The first thing 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

The third option is to go --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.

@@ -752,7 +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. - On top of that, the last commit has been undone.

+ 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.

-- cgit v1.2.3 From 450a1c1b1890ef519a5dc43980a2b70c2b7dda45 Mon Sep 17 00:00:00 2001 From: Soon Van Date: Wed, 22 May 2013 13:56:20 -0400 Subject: Clarify where git reset moves HEAD, affect on stage, index --- basic/index.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/basic/index.html b/basic/index.html index 100c11d..6c765b5 100644 --- a/basic/index.html +++ b/basic/index.html @@ -691,7 +691,7 @@ M hello.rb

git reset --soft - moves what HEAD points to, index and staging are untouched + moves HEAD to specified commit reference, index and staging are untouched

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.

+ The working tree and staging area are reset to the tip of the current + branch or HEAD.

You can replace HEAD with a commit SHA-1 or another parent reference to reset to that specific point.

-- cgit v1.2.3