{"thread":{"id":"24412","subject":"[RFC PATCH 0/5] git-reset documentation changes","startedAt":"2010-07-16T09:44:37Z","lastAt":"2010-07-18T18:23:26Z","messageCount":14,"participants":["Thomas Rast","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":5},"messages":[{"id":"145678","messageId":"cover.1279273256.git.trast@student.ethz.ch","threadId":"24412","inReplyTo":null,"subject":"[RFC PATCH 0/5] git-reset documentation changes","fromName":"Thomas Rast","fromEmail":"trast@student.ethz.ch","sentAt":"2010-07-16T09:44:37Z","receivedAt":"2010-07-16T09:44:37Z","isPatch":true,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"I wrote this on the bus travelling to France, and haven't got around\nto sending it out since then.\n\nThe main goal was the first patch, which redoes the 'description'\nsection in the style pioneered by b831ded (Documentation/checkout:\nclarify description, 2010-06-01) in git-checkout(1).\n\nThe rest are just various ideas that I'm tossing around.  I also would\nlike to shorten the 'examples' section significantly if anyone sees a\nway to do that without a huge loss of explanations.  I think the\nchances that users consult the current version aren't exactly great\nbecause of its length.\n\nThomas Rast (5):\n  Documentation/git-reset: reorder modes for soft-mixed-hard\n    progression\n  Documentation/reset: separate options by mode\n  Documentation/reset: promote 'examples' one section up\n  Documentation/reset: reorder examples to match description\n  Documentation/reset: move \"undo permanently\" example behind \"make\n    topic\"\n\n Documentation/git-reset.txt |  346 ++++++++++++++++++++++---------------------\n 1 files changed, 177 insertions(+), 169 deletions(-)\n\n-- \n1.7.2.rc3.259.g43154\n"},{"id":"145679","messageId":"53e88b5a527fc4fc97750bbfbd74077ef699351a.1279273256.git.trast@student.ethz.ch","threadId":"24412","inReplyTo":"cover.1279273256.git.trast@student.ethz.ch","subject":"[RFC PATCH 1/5] Documentation/git-reset: reorder modes for soft-mixed-hard progression","fromName":"Thomas Rast","fromEmail":"trast@student.ethz.ch","sentAt":"2010-07-16T09:44:38Z","receivedAt":"2010-07-16T09:44:38Z","isPatch":true,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"Reorder the documetation so that the soft/mixed/hard modes are in this\norder.  This way they form a natural progression towards changing more\nof the state.\n\nSigned-off-by: Thomas Rast <trast@student.ethz.ch>\n---\n Documentation/git-reset.txt |   12 ++++++------\n 1 files changed, 6 insertions(+), 6 deletions(-)\n\ndiff --git a/Documentation/git-reset.txt b/Documentation/git-reset.txt\nindex 645f0c1..dbb810d 100644\n--- a/Documentation/git-reset.txt\n+++ b/Documentation/git-reset.txt\n@@ -8,7 +8,7 @@ git-reset - Reset current HEAD to the specified state\n SYNOPSIS\n --------\n [verse]\n-'git reset' [--mixed | --soft | --hard | --merge | --keep] [-q] [<commit>]\n+'git reset' [--soft | --mixed | --hard | --merge | --keep] [-q] [<commit>]\n 'git reset' [-q] [<commit>] [--] <paths>...\n 'git reset' --patch [<commit>] [--] [<paths>...]\n \n@@ -31,17 +31,17 @@ HEAD.\n \n OPTIONS\n -------\n---mixed::\n-\tResets the index but not the working tree (i.e., the changed files\n-\tare preserved but not marked for commit) and reports what has not\n-\tbeen updated. This is the default action.\n-\n --soft::\n \tDoes not touch the index file nor the working tree at all, but\n \trequires them to be in a good order. This leaves all your changed\n \tfiles \"Changes to be committed\", as 'git status' would\n \tput it.\n \n+--mixed::\n+\tResets the index but not the working tree (i.e., the changed files\n+\tare preserved but not marked for commit) and reports what has not\n+\tbeen updated. This is the default action.\n+\n --hard::\n \tMatches the working tree and index to that of the tree being\n \tswitched to. Any changes to tracked files in the working tree\n-- \n1.7.2.rc3.259.g43154\n"},{"id":"145680","messageId":"0bfc95a7c144ccc811b58321a33caf89d20495e1.1279273256.git.trast@student.ethz.ch","threadId":"24412","inReplyTo":"cover.1279273256.git.trast@student.ethz.ch","subject":"[RFC PATCH 2/5] Documentation/reset: separate options by mode","fromName":"Thomas Rast","fromEmail":"trast@student.ethz.ch","sentAt":"2010-07-16T09:44:39Z","receivedAt":"2010-07-16T09:44:39Z","isPatch":true,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"Remove all but -q from the OPTIONS section, and instead explain the\noptions separated by usage mode, since they only apply to one each.\n\nSigned-off-by: Thomas Rast <trast@student.ethz.ch>\n\nfixup! Documentation/reset: separate options by mode\n---\n Documentation/git-reset.txt |   58 +++++++++++++++++++++++-------------------\n 1 files changed, 32 insertions(+), 26 deletions(-)\n\ndiff --git a/Documentation/git-reset.txt b/Documentation/git-reset.txt\nindex dbb810d..46b2d2a 100644\n--- a/Documentation/git-reset.txt\n+++ b/Documentation/git-reset.txt\n@@ -8,29 +8,38 @@ git-reset - Reset current HEAD to the specified state\n SYNOPSIS\n --------\n [verse]\n-'git reset' [--soft | --mixed | --hard | --merge | --keep] [-q] [<commit>]\n 'git reset' [-q] [<commit>] [--] <paths>...\n 'git reset' --patch [<commit>] [--] [<paths>...]\n+'git reset' [--soft | --mixed | --hard | --merge | --keep] [-q] [<commit>]\n \n DESCRIPTION\n -----------\n-Sets the current head to the specified commit and optionally resets the\n-index and working tree to match.\n-\n-This command is useful if you notice some small error in a recent\n-commit (or set of commits) and want to redo that part without showing\n-the undo in the history.\n-\n-If you want to undo a commit other than the latest on a branch,\n-linkgit:git-revert[1] is your friend.\n-\n-The second and third forms with 'paths' and/or --patch are used to\n-revert selected paths in the index from a given commit, without moving\n-HEAD.\n+Sets the current branch to the specified <commit> and optionally\n+resets the index and working tree to match.  The <commit> defaults to\n+HEAD in all forms.\n+\n+'git reset' [-q] [<commit>] [--] <paths>...::\n+\tThis form resets the index entries for all <paths> to their\n+\tstate at the <commit>.  (It does not affect the worktree, nor\n+\tthe current branch.)\n++\n+This means that `git reset <paths>` is the opposite of `git add\n+<paths>`, provided that the <paths> were already tracked.\n \n+'git reset' --patch|-p [<commit>] [--] [<paths>...]::\n+\tInteractively select hunks in the difference between the index\n+\tand <commit> (defaults to HEAD).  The chosen hunks are applied\n+\tin reverse to the index.\n++\n+This means that `git reset -p` is the opposite of `git add -p` (see\n+linkgit:git-add[1]).\n \n-OPTIONS\n--------\n+'git reset' [--<mode>] [<commit>]::\n+\tThis form points the current branch to <commit> and then\n+\tupdates index and working tree according to <mode>, which must\n+\tbe one of the following:\n++\n+--\n --soft::\n \tDoes not touch the index file nor the working tree at all, but\n \trequires them to be in a good order. This leaves all your changed\n@@ -59,22 +68,19 @@ OPTIONS\n \tthe given commit.  If a file that is different between the\n \tcurrent commit and the given commit has local changes, reset\n \tis aborted.\n+--\n \n--p::\n---patch::\n-\tInteractively select hunks in the difference between the index\n-\tand <commit> (defaults to HEAD).  The chosen hunks are applied\n-\tin reverse to the index.\n-+\n-This means that `git reset -p` is the opposite of `git add -p` (see\n-linkgit:git-add[1]).\n+If you want to undo a commit other than the latest on a branch,\n+linkgit:git-revert[1] is your friend.\n+\n+\n+OPTIONS\n+-------\n \n -q::\n --quiet::\n \tBe quiet, only report errors.\n \n-<commit>::\n-\tCommit to make the current HEAD. If not given defaults to HEAD.\n \n DISCUSSION\n ----------\n-- \n1.7.2.rc3.259.g43154\n"},{"id":"145682","messageId":"a9c412a9659828ae32c970f78b78d735b338e8d2.1279273256.git.trast@student.ethz.ch","threadId":"24412","inReplyTo":"cover.1279273256.git.trast@student.ethz.ch","subject":"[RFC PATCH 3/5] Documentation/reset: promote 'examples' one section up","fromName":"Thomas Rast","fromEmail":"trast@student.ethz.ch","sentAt":"2010-07-16T09:44:40Z","receivedAt":"2010-07-16T09:44:40Z","isPatch":true,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"Move the examples section upwards, before the discussion that gives\nthe gory details.  Adjust the style of the heading accordingly.\n\nSigned-off-by: Thomas Rast <trast@student.ethz.ch>\n---\n Documentation/git-reset.txt |  216 ++++++++++++++++++++++---------------------\n 1 files changed, 109 insertions(+), 107 deletions(-)\n\ndiff --git a/Documentation/git-reset.txt b/Documentation/git-reset.txt\nindex 46b2d2a..41edf41 100644\n--- a/Documentation/git-reset.txt\n+++ b/Documentation/git-reset.txt\n@@ -82,113 +82,7 @@ OPTIONS\n \tBe quiet, only report errors.\n \n \n-DISCUSSION\n-----------\n-\n-The tables below show what happens when running:\n-\n-----------\n-git reset --option target\n-----------\n-\n-to reset the HEAD to another commit (`target`) with the different\n-reset options depending on the state of the files.\n-\n-In these tables, A, B, C and D are some different states of a\n-file. For example, the first line of the first table means that if a\n-file is in state A in the working tree, in state B in the index, in\n-state C in HEAD and in state D in the target, then \"git reset --soft\n-target\" will put the file in state A in the working tree, in state B\n-in the index and in state D in HEAD.\n-\n-      working index HEAD target         working index HEAD\n-      ----------------------------------------------------\n-       A       B     C    D     --soft   A       B     D\n-\t\t\t\t--mixed  A       D     D\n-\t\t\t\t--hard   D       D     D\n-\t\t\t\t--merge (disallowed)\n-\t\t\t\t--keep  (disallowed)\n-\n-      working index HEAD target         working index HEAD\n-      ----------------------------------------------------\n-       A       B     C    C     --soft   A       B     C\n-\t\t\t\t--mixed  A       C     C\n-\t\t\t\t--hard   C       C     C\n-\t\t\t\t--merge (disallowed)\n-\t\t\t\t--keep   A       C     C\n-\n-      working index HEAD target         working index HEAD\n-      ----------------------------------------------------\n-       B       B     C    D     --soft   B       B     D\n-\t\t\t\t--mixed  B       D     D\n-\t\t\t\t--hard   D       D     D\n-\t\t\t\t--merge  D       D     D\n-\t\t\t\t--keep  (disallowed)\n-\n-      working index HEAD target         working index HEAD\n-      ----------------------------------------------------\n-       B       B     C    C     --soft   B       B     C\n-\t\t\t\t--mixed  B       C     C\n-\t\t\t\t--hard   C       C     C\n-\t\t\t\t--merge  C       C     C\n-\t\t\t\t--keep   B       C     C\n-\n-      working index HEAD target         working index HEAD\n-      ----------------------------------------------------\n-       B       C     C    D     --soft   B       C     D\n-\t\t\t\t--mixed  B       D     D\n-\t\t\t\t--hard   D       D     D\n-\t\t\t\t--merge (disallowed)\n-\t\t\t\t--keep  (disallowed)\n-\n-      working index HEAD target         working index HEAD\n-      ----------------------------------------------------\n-       B       C     C    C     --soft   B       C     C\n-\t\t\t\t--mixed  B       C     C\n-\t\t\t\t--hard   C       C     C\n-\t\t\t\t--merge  B       C     C\n-\t\t\t\t--keep   B       C     C\n-\n-\"reset --merge\" is meant to be used when resetting out of a conflicted\n-merge. Any mergy operation guarantees that the work tree file that is\n-involved in the merge does not have local change wrt the index before\n-it starts, and that it writes the result out to the work tree. So if\n-we see some difference between the index and the target and also\n-between the index and the work tree, then it means that we are not\n-resetting out from a state that a mergy operation left after failing\n-with a conflict. That is why we disallow --merge option in this case.\n-\n-\"reset --keep\" is meant to be used when removing some of the last\n-commits in the current branch while keeping changes in the working\n-tree. If there could be conflicts between the changes in the commit we\n-want to remove and the changes in the working tree we want to keep,\n-the reset is disallowed. That's why it is disallowed if there are both\n-changes between the working tree and HEAD, and between HEAD and the\n-target. To be safe, it is also disallowed when there are unmerged\n-entries.\n-\n-The following tables show what happens when there are unmerged\n-entries:\n-\n-      working index HEAD target         working index HEAD\n-      ----------------------------------------------------\n-       X       U     A    B     --soft  (disallowed)\n-\t\t\t\t--mixed  X       B     B\n-\t\t\t\t--hard   B       B     B\n-\t\t\t\t--merge  B       B     B\n-\t\t\t\t--keep  (disallowed)\n-\n-      working index HEAD target         working index HEAD\n-      ----------------------------------------------------\n-       X       U     A    A     --soft  (disallowed)\n-\t\t\t\t--mixed  X       A     A\n-\t\t\t\t--hard   A       A     A\n-\t\t\t\t--merge  A       A     A\n-\t\t\t\t--keep  (disallowed)\n-\n-X means any state and U means an unmerged index.\n-\n-Examples\n+EXAMPLES\n --------\n \n Undo a commit and redo::\n@@ -382,6 +276,114 @@ $ git reset --keep start                    <3>\n <3> But you can use \"reset --keep\" to remove the unwanted commit after\n     you switched to \"branch2\".\n \n+\n+DISCUSSION\n+----------\n+\n+The tables below show what happens when running:\n+\n+----------\n+git reset --option target\n+----------\n+\n+to reset the HEAD to another commit (`target`) with the different\n+reset options depending on the state of the files.\n+\n+In these tables, A, B, C and D are some different states of a\n+file. For example, the first line of the first table means that if a\n+file is in state A in the working tree, in state B in the index, in\n+state C in HEAD and in state D in the target, then \"git reset --soft\n+target\" will put the file in state A in the working tree, in state B\n+in the index and in state D in HEAD.\n+\n+      working index HEAD target         working index HEAD\n+      ----------------------------------------------------\n+       A       B     C    D     --soft   A       B     D\n+\t\t\t\t--mixed  A       D     D\n+\t\t\t\t--hard   D       D     D\n+\t\t\t\t--merge (disallowed)\n+\t\t\t\t--keep  (disallowed)\n+\n+      working index HEAD target         working index HEAD\n+      ----------------------------------------------------\n+       A       B     C    C     --soft   A       B     C\n+\t\t\t\t--mixed  A       C     C\n+\t\t\t\t--hard   C       C     C\n+\t\t\t\t--merge (disallowed)\n+\t\t\t\t--keep   A       C     C\n+\n+      working index HEAD target         working index HEAD\n+      ----------------------------------------------------\n+       B       B     C    D     --soft   B       B     D\n+\t\t\t\t--mixed  B       D     D\n+\t\t\t\t--hard   D       D     D\n+\t\t\t\t--merge  D       D     D\n+\t\t\t\t--keep  (disallowed)\n+\n+      working index HEAD target         working index HEAD\n+      ----------------------------------------------------\n+       B       B     C    C     --soft   B       B     C\n+\t\t\t\t--mixed  B       C     C\n+\t\t\t\t--hard   C       C     C\n+\t\t\t\t--merge  C       C     C\n+\t\t\t\t--keep   B       C     C\n+\n+      working index HEAD target         working index HEAD\n+      ----------------------------------------------------\n+       B       C     C    D     --soft   B       C     D\n+\t\t\t\t--mixed  B       D     D\n+\t\t\t\t--hard   D       D     D\n+\t\t\t\t--merge (disallowed)\n+\t\t\t\t--keep  (disallowed)\n+\n+      working index HEAD target         working index HEAD\n+      ----------------------------------------------------\n+       B       C     C    C     --soft   B       C     C\n+\t\t\t\t--mixed  B       C     C\n+\t\t\t\t--hard   C       C     C\n+\t\t\t\t--merge  B       C     C\n+\t\t\t\t--keep   B       C     C\n+\n+\"reset --merge\" is meant to be used when resetting out of a conflicted\n+merge. Any mergy operation guarantees that the work tree file that is\n+involved in the merge does not have local change wrt the index before\n+it starts, and that it writes the result out to the work tree. So if\n+we see some difference between the index and the target and also\n+between the index and the work tree, then it means that we are not\n+resetting out from a state that a mergy operation left after failing\n+with a conflict. That is why we disallow --merge option in this case.\n+\n+\"reset --keep\" is meant to be used when removing some of the last\n+commits in the current branch while keeping changes in the working\n+tree. If there could be conflicts between the changes in the commit we\n+want to remove and the changes in the working tree we want to keep,\n+the reset is disallowed. That's why it is disallowed if there are both\n+changes between the working tree and HEAD, and between HEAD and the\n+target. To be safe, it is also disallowed when there are unmerged\n+entries.\n+\n+The following tables show what happens when there are unmerged\n+entries:\n+\n+      working index HEAD target         working index HEAD\n+      ----------------------------------------------------\n+       X       U     A    B     --soft  (disallowed)\n+\t\t\t\t--mixed  X       B     B\n+\t\t\t\t--hard   B       B     B\n+\t\t\t\t--merge  B       B     B\n+\t\t\t\t--keep  (disallowed)\n+\n+      working index HEAD target         working index HEAD\n+      ----------------------------------------------------\n+       X       U     A    A     --soft  (disallowed)\n+\t\t\t\t--mixed  X       A     A\n+\t\t\t\t--hard   A       A     A\n+\t\t\t\t--merge  A       A     A\n+\t\t\t\t--keep  (disallowed)\n+\n+X means any state and U means an unmerged index.\n+\n+\n Author\n ------\n Written by Junio C Hamano <gitster@pobox.com> and Linus Torvalds <torvalds@osdl.org>\n-- \n1.7.2.rc3.259.g43154\n"},{"id":"145681","messageId":"4d6d6155927b8ec371a4898d89bbcccdb18af48f.1279273256.git.trast@student.ethz.ch","threadId":"24412","inReplyTo":"cover.1279273256.git.trast@student.ethz.ch","subject":"[RFC PATCH 4/5] Documentation/reset: reorder examples to match description","fromName":"Thomas Rast","fromEmail":"trast@student.ethz.ch","sentAt":"2010-07-16T09:44:41Z","receivedAt":"2010-07-16T09:44:41Z","isPatch":true,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"A previous commit moved the <paths> mode (undoes git-add) to the front\nin the description, so make the examples follow the same order.\n\nSigned-off-by: Thomas Rast <trast@student.ethz.ch>\n---\n Documentation/git-reset.txt |   46 +++++++++++++++++++++---------------------\n 1 files changed, 23 insertions(+), 23 deletions(-)\n\ndiff --git a/Documentation/git-reset.txt b/Documentation/git-reset.txt\nindex 41edf41..ce08581 100644\n--- a/Documentation/git-reset.txt\n+++ b/Documentation/git-reset.txt\n@@ -85,6 +85,29 @@ OPTIONS\n EXAMPLES\n --------\n \n+Undo add::\n++\n+------------\n+$ edit                                     <1>\n+$ git add frotz.c filfre.c\n+$ mailx                                    <2>\n+$ git reset                                <3>\n+$ git pull git://info.example.com/ nitfol  <4>\n+------------\n++\n+<1> You are happily working on something, and find the changes\n+in these files are in good order.  You do not want to see them\n+when you run \"git diff\", because you plan to work on other files\n+and changes with these files are distracting.\n+<2> Somebody asks you to pull, and the changes sounds worthy of merging.\n+<3> However, you already dirtied the index (i.e. your index does\n+not match the HEAD commit).  But you know the pull you are going\n+to make does not affect frotz.c nor filfre.c, so you revert the\n+index changes for these two files.  Your changes in working tree\n+remain there.\n+<4> Then you can pull and merge, leaving frotz.c and filfre.c\n+changes still in the working tree.\n+\n Undo a commit and redo::\n +\n ------------\n@@ -132,29 +155,6 @@ current HEAD.\n <2> Rewind the master branch to get rid of those three commits.\n <3> Switch to \"topic/wip\" branch and keep working.\n \n-Undo add::\n-+\n-------------\n-$ edit                                     <1>\n-$ git add frotz.c filfre.c\n-$ mailx                                    <2>\n-$ git reset                                <3>\n-$ git pull git://info.example.com/ nitfol  <4>\n-------------\n-+\n-<1> You are happily working on something, and find the changes\n-in these files are in good order.  You do not want to see them\n-when you run \"git diff\", because you plan to work on other files\n-and changes with these files are distracting.\n-<2> Somebody asks you to pull, and the changes sounds worthy of merging.\n-<3> However, you already dirtied the index (i.e. your index does\n-not match the HEAD commit).  But you know the pull you are going\n-to make does not affect frotz.c nor filfre.c, so you revert the\n-index changes for these two files.  Your changes in working tree\n-remain there.\n-<4> Then you can pull and merge, leaving frotz.c and filfre.c\n-changes still in the working tree.\n-\n Undo a merge or pull::\n +\n ------------\n-- \n1.7.2.rc3.259.g43154\n"},{"id":"145683","messageId":"acd131cb3c2f6f7d4aca2c53738fb458380bb8c9.1279273256.git.trast@student.ethz.ch","threadId":"24412","inReplyTo":"cover.1279273256.git.trast@student.ethz.ch","subject":"[RFC PATCH 5/5] Documentation/reset: move \"undo permanently\" example behind \"make topic\"","fromName":"Thomas Rast","fromEmail":"trast@student.ethz.ch","sentAt":"2010-07-16T09:44:42Z","receivedAt":"2010-07-16T09:44:42Z","isPatch":true,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"I consider the latter usage more important.\n\nSigned-off-by: Thomas Rast <trast@student.ethz.ch>\n---\n Documentation/git-reset.txt |   26 +++++++++++++-------------\n 1 files changed, 13 insertions(+), 13 deletions(-)\n\ndiff --git a/Documentation/git-reset.txt b/Documentation/git-reset.txt\nindex ce08581..34da771 100644\n--- a/Documentation/git-reset.txt\n+++ b/Documentation/git-reset.txt\n@@ -127,19 +127,6 @@ edit the message further, you can give -C option instead.\n +\n See also the --amend option to linkgit:git-commit[1].\n \n-Undo commits permanently::\n-+\n-------------\n-$ git commit ...\n-$ git reset --hard HEAD~3   <1>\n-------------\n-+\n-<1> The last three commits (HEAD, HEAD^, and HEAD~2) were bad\n-and you do not want to ever see them again.  Do *not* do this if\n-you have already given these commits to somebody else.  (See the\n-\"RECOVERING FROM UPSTREAM REBASE\" section in linkgit:git-rebase[1] for\n-the implications of doing so.)\n-\n Undo a commit, making it a topic branch::\n +\n ------------\n@@ -155,6 +142,19 @@ current HEAD.\n <2> Rewind the master branch to get rid of those three commits.\n <3> Switch to \"topic/wip\" branch and keep working.\n \n+Undo commits permanently::\n++\n+------------\n+$ git commit ...\n+$ git reset --hard HEAD~3   <1>\n+------------\n++\n+<1> The last three commits (HEAD, HEAD^, and HEAD~2) were bad\n+and you do not want to ever see them again.  Do *not* do this if\n+you have already given these commits to somebody else.  (See the\n+\"RECOVERING FROM UPSTREAM REBASE\" section in linkgit:git-rebase[1] for\n+the implications of doing so.)\n+\n Undo a merge or pull::\n +\n ------------\n-- \n1.7.2.rc3.259.g43154\n"},{"id":"145709","messageId":"7v7hkvrwd0.fsf@alter.siamese.dyndns.org","threadId":"24412","inReplyTo":"0bfc95a7c144ccc811b58321a33caf89d20495e1.1279273256.git.trast@student.ethz.ch","subject":"Re: [RFC PATCH 2/5] Documentation/reset: separate options by mode","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-07-16T20:43:23Z","receivedAt":"2010-07-16T20:43:23Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Thomas Rast <trast@student.ethz.ch> writes:\n\n> Remove all but -q from the OPTIONS section, and instead explain the\n> options separated by usage mode, since they only apply to one each.\n>\n> Signed-off-by: Thomas Rast <trast@student.ethz.ch>\n>\n> fixup! Documentation/reset: separate options by mode\n> ---\n>  Documentation/git-reset.txt |   58 +++++++++++++++++++++++-------------------\n>  1 files changed, 32 insertions(+), 26 deletions(-)\n>\n> diff --git a/Documentation/git-reset.txt b/Documentation/git-reset.txt\n> index dbb810d..46b2d2a 100644\n> --- a/Documentation/git-reset.txt\n> +++ b/Documentation/git-reset.txt\n> @@ -8,29 +8,38 @@ git-reset - Reset current HEAD to the specified state\n>  SYNOPSIS\n>  --------\n>  [verse]\n> -'git reset' [--soft | --mixed | --hard | --merge | --keep] [-q] [<commit>]\n>  'git reset' [-q] [<commit>] [--] <paths>...\n>  'git reset' --patch [<commit>] [--] [<paths>...]\n> +'git reset' [--soft | --mixed | --hard | --merge | --keep] [-q] [<commit>]\n>  \n>  DESCRIPTION\n>  -----------\n> +Sets the current branch to the specified <commit> and optionally\n> +resets the index and working tree to match.  The <commit> defaults to\n> +HEAD in all forms.\n\nWith a careless reading of this paragraph, I got an impression that HEAD\nis always affected, but I happen to know that is not the case ;-).\n\n - \"reset\" is primarily about resetting the index and the --soft option\n   can be used to optionally not to do this.\n\n   . with paths, the command is about fixing up the index contents for\n     given specific paths, to prepare for the next commit.  HEAD is not\n     moved.\n\n   . without paths, the command is about changing what commit to build\n     your next commit on, i.e. HEAD is moved.\n\n> +'git reset' [-q] [<commit>] [--] <paths>...::\n> +\tThis form resets the index entries for all <paths> to their\n> +\tstate at the <commit>.  (It does not affect the worktree, nor\n> +\tthe current branch.)\n> ++\n> +This means that `git reset <paths>` is the opposite of `git add\n> +<paths>`, provided that the <paths> were already tracked.\n\nThe above is a clearer description of \"with-path\" mode than what we\ncurrently have.  I doubt that we need \", provided that...\", though.  \n\n\"git reset HEAD frotz\" from a head commit without frotz gets rid of frotz\nfrom the index, no?\n"},{"id":"145711","messageId":"7v39vjrvl4.fsf@alter.siamese.dyndns.org","threadId":"24412","inReplyTo":"cover.1279273256.git.trast@student.ethz.ch","subject":"Re: [RFC PATCH 0/5] git-reset documentation changes","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-07-16T21:00:07Z","receivedAt":"2010-07-16T21:00:07Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Thomas Rast <trast@student.ethz.ch> writes:\n\n> I wrote this on the bus travelling to France, and haven't got around\n> to sending it out since then.\n>\n> The main goal was the first patch, which redoes the 'description'\n> section in the style pioneered by b831ded (Documentation/checkout:\n> clarify description, 2010-06-01) in git-checkout(1).\n>\n> The rest are just various ideas that I'm tossing around.  I also would\n> like to shorten the 'examples' section significantly if anyone sees a\n> way to do that without a huge loss of explanations.  I think the\n> chances that users consult the current version aren't exactly great\n> because of its length.\n\nExcept for one small nit or two I mentioned in a separate message, I like\nthe overall direction of this series.\n\nThanks.\n"},{"id":"145770","messageId":"cover.1279477130.git.trast@student.ethz.ch","threadId":"24412","inReplyTo":"7v7hkvrwd0.fsf@alter.siamese.dyndns.org","subject":"[PATCH v2 0/5] git-reset documentation changes","fromName":"Thomas Rast","fromEmail":"trast@student.ethz.ch","sentAt":"2010-07-18T18:23:21Z","receivedAt":"2010-07-18T18:23:21Z","isPatch":true,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"Junio C Hamano wrote:\n[on patch 2/5]\n> >  DESCRIPTION\n> >  -----------\n> > +Sets the current branch to the specified <commit> and optionally\n> > +resets the index and working tree to match.  The <commit> defaults to\n> > +HEAD in all forms.\n> \n> With a careless reading of this paragraph, I got an impression that HEAD\n> is always affected, but I happen to know that is not the case ;-).\n> \n>  - \"reset\" is primarily about resetting the index and the --soft option\n>    can be used to optionally not to do this.\n> \n>    . with paths, the command is about fixing up the index contents for\n>      given specific paths, to prepare for the next commit.  HEAD is not\n>      moved.\n> \n>    . without paths, the command is about changing what commit to build\n>      your next commit on, i.e. HEAD is moved.\n\nYou're right, I completely left out the <paths> mode there.  I rewrote\nthis as a short summary of all three modes in this version.\n\n> \"git reset HEAD frotz\" from a head commit without frotz gets rid of frotz\n> from the index, no?\n\nTrue.  I thought it didn't (and required rm --cached) but I must have\nmixed up something.\n\nThe other patches are unchanged from v1.\n\n\nThomas Rast (5):\n  Documentation/git-reset: reorder modes for soft-mixed-hard\n    progression\n  Documentation/reset: separate options by mode\n  Documentation/reset: promote 'examples' one section up\n  Documentation/reset: reorder examples to match description\n  Documentation/reset: move \"undo permanently\" example behind \"make\n    topic\"\n\n Documentation/git-reset.txt |  347 ++++++++++++++++++++++---------------------\n 1 files changed, 178 insertions(+), 169 deletions(-)\n\n-- \n1.7.2.rc3.317.gc287\n"},{"id":"145771","messageId":"e1b0c4024710394a5c9787c95f479a827ba18591.1279477130.git.trast@student.ethz.ch","threadId":"24412","inReplyTo":"cover.1279477130.git.trast@student.ethz.ch","subject":"[PATCH v2 1/5] Documentation/git-reset: reorder modes for soft-mixed-hard progression","fromName":"Thomas Rast","fromEmail":"trast@student.ethz.ch","sentAt":"2010-07-18T18:23:22Z","receivedAt":"2010-07-18T18:23:22Z","isPatch":true,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"Reorder the documetation so that the soft/mixed/hard modes are in this\norder.  This way they form a natural progression towards changing more\nof the state.\n\nSigned-off-by: Thomas Rast <trast@student.ethz.ch>\n---\n Documentation/git-reset.txt |   12 ++++++------\n 1 files changed, 6 insertions(+), 6 deletions(-)\n\ndiff --git a/Documentation/git-reset.txt b/Documentation/git-reset.txt\nindex 645f0c1..dbb810d 100644\n--- a/Documentation/git-reset.txt\n+++ b/Documentation/git-reset.txt\n@@ -8,7 +8,7 @@ git-reset - Reset current HEAD to the specified state\n SYNOPSIS\n --------\n [verse]\n-'git reset' [--mixed | --soft | --hard | --merge | --keep] [-q] [<commit>]\n+'git reset' [--soft | --mixed | --hard | --merge | --keep] [-q] [<commit>]\n 'git reset' [-q] [<commit>] [--] <paths>...\n 'git reset' --patch [<commit>] [--] [<paths>...]\n \n@@ -31,17 +31,17 @@ HEAD.\n \n OPTIONS\n -------\n---mixed::\n-\tResets the index but not the working tree (i.e., the changed files\n-\tare preserved but not marked for commit) and reports what has not\n-\tbeen updated. This is the default action.\n-\n --soft::\n \tDoes not touch the index file nor the working tree at all, but\n \trequires them to be in a good order. This leaves all your changed\n \tfiles \"Changes to be committed\", as 'git status' would\n \tput it.\n \n+--mixed::\n+\tResets the index but not the working tree (i.e., the changed files\n+\tare preserved but not marked for commit) and reports what has not\n+\tbeen updated. This is the default action.\n+\n --hard::\n \tMatches the working tree and index to that of the tree being\n \tswitched to. Any changes to tracked files in the working tree\n-- \n1.7.2.rc3.317.gc287\n"},{"id":"145772","messageId":"975d0001acbaf4f33fa9b51ce878a9247b8a9e5f.1279477130.git.trast@student.ethz.ch","threadId":"24412","inReplyTo":"cover.1279477130.git.trast@student.ethz.ch","subject":"[PATCH v2 2/5] Documentation/reset: separate options by mode","fromName":"Thomas Rast","fromEmail":"trast@student.ethz.ch","sentAt":"2010-07-18T18:23:23Z","receivedAt":"2010-07-18T18:23:23Z","isPatch":true,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"Remove all but -q from the OPTIONS section, and instead explain the\noptions separated by usage mode, since they only apply to one each.\n\nSigned-off-by: Thomas Rast <trast@student.ethz.ch>\n---\n Documentation/git-reset.txt |   59 ++++++++++++++++++++++++-------------------\n 1 files changed, 33 insertions(+), 26 deletions(-)\n\ndiff --git a/Documentation/git-reset.txt b/Documentation/git-reset.txt\nindex dbb810d..dca75b3 100644\n--- a/Documentation/git-reset.txt\n+++ b/Documentation/git-reset.txt\n@@ -8,29 +8,39 @@ git-reset - Reset current HEAD to the specified state\n SYNOPSIS\n --------\n [verse]\n-'git reset' [--soft | --mixed | --hard | --merge | --keep] [-q] [<commit>]\n 'git reset' [-q] [<commit>] [--] <paths>...\n 'git reset' --patch [<commit>] [--] [<paths>...]\n+'git reset' [--soft | --mixed | --hard | --merge | --keep] [-q] [<commit>]\n \n DESCRIPTION\n -----------\n-Sets the current head to the specified commit and optionally resets the\n-index and working tree to match.\n-\n-This command is useful if you notice some small error in a recent\n-commit (or set of commits) and want to redo that part without showing\n-the undo in the history.\n-\n-If you want to undo a commit other than the latest on a branch,\n-linkgit:git-revert[1] is your friend.\n-\n-The second and third forms with 'paths' and/or --patch are used to\n-revert selected paths in the index from a given commit, without moving\n-HEAD.\n+In the first and second form, copy entries from <commit> to the index.\n+In the third form, set the current branch to <commit>, optionally\n+modifying index and worktree to match.  The <commit> defaults to HEAD\n+in all forms.\n+\n+'git reset' [-q] [<commit>] [--] <paths>...::\n+\tThis form resets the index entries for all <paths> to their\n+\tstate at the <commit>.  (It does not affect the worktree, nor\n+\tthe current branch.)\n++\n+This means that `git reset <paths>` is the opposite of `git add\n+<paths>`.\n \n+'git reset' --patch|-p [<commit>] [--] [<paths>...]::\n+\tInteractively select hunks in the difference between the index\n+\tand <commit> (defaults to HEAD).  The chosen hunks are applied\n+\tin reverse to the index.\n++\n+This means that `git reset -p` is the opposite of `git add -p` (see\n+linkgit:git-add[1]).\n \n-OPTIONS\n--------\n+'git reset' [--<mode>] [<commit>]::\n+\tThis form points the current branch to <commit> and then\n+\tupdates index and working tree according to <mode>, which must\n+\tbe one of the following:\n++\n+--\n --soft::\n \tDoes not touch the index file nor the working tree at all, but\n \trequires them to be in a good order. This leaves all your changed\n@@ -59,22 +69,19 @@ OPTIONS\n \tthe given commit.  If a file that is different between the\n \tcurrent commit and the given commit has local changes, reset\n \tis aborted.\n+--\n \n--p::\n---patch::\n-\tInteractively select hunks in the difference between the index\n-\tand <commit> (defaults to HEAD).  The chosen hunks are applied\n-\tin reverse to the index.\n-+\n-This means that `git reset -p` is the opposite of `git add -p` (see\n-linkgit:git-add[1]).\n+If you want to undo a commit other than the latest on a branch,\n+linkgit:git-revert[1] is your friend.\n+\n+\n+OPTIONS\n+-------\n \n -q::\n --quiet::\n \tBe quiet, only report errors.\n \n-<commit>::\n-\tCommit to make the current HEAD. If not given defaults to HEAD.\n \n DISCUSSION\n ----------\n-- \n1.7.2.rc3.317.gc287\n"},{"id":"145775","messageId":"469f6ac3519d656e6755f4ceda9df49778dc9cb5.1279477130.git.trast@student.ethz.ch","threadId":"24412","inReplyTo":"cover.1279477130.git.trast@student.ethz.ch","subject":"[PATCH v2 3/5] Documentation/reset: promote 'examples' one section up","fromName":"Thomas Rast","fromEmail":"trast@student.ethz.ch","sentAt":"2010-07-18T18:23:24Z","receivedAt":"2010-07-18T18:23:24Z","isPatch":true,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"Move the examples section upwards, before the discussion that gives\nthe gory details.  Adjust the style of the heading accordingly.\n\nSigned-off-by: Thomas Rast <trast@student.ethz.ch>\n---\n Documentation/git-reset.txt |  216 ++++++++++++++++++++++---------------------\n 1 files changed, 109 insertions(+), 107 deletions(-)\n\ndiff --git a/Documentation/git-reset.txt b/Documentation/git-reset.txt\nindex dca75b3..70198f9 100644\n--- a/Documentation/git-reset.txt\n+++ b/Documentation/git-reset.txt\n@@ -83,113 +83,7 @@ OPTIONS\n \tBe quiet, only report errors.\n \n \n-DISCUSSION\n-----------\n-\n-The tables below show what happens when running:\n-\n-----------\n-git reset --option target\n-----------\n-\n-to reset the HEAD to another commit (`target`) with the different\n-reset options depending on the state of the files.\n-\n-In these tables, A, B, C and D are some different states of a\n-file. For example, the first line of the first table means that if a\n-file is in state A in the working tree, in state B in the index, in\n-state C in HEAD and in state D in the target, then \"git reset --soft\n-target\" will put the file in state A in the working tree, in state B\n-in the index and in state D in HEAD.\n-\n-      working index HEAD target         working index HEAD\n-      ----------------------------------------------------\n-       A       B     C    D     --soft   A       B     D\n-\t\t\t\t--mixed  A       D     D\n-\t\t\t\t--hard   D       D     D\n-\t\t\t\t--merge (disallowed)\n-\t\t\t\t--keep  (disallowed)\n-\n-      working index HEAD target         working index HEAD\n-      ----------------------------------------------------\n-       A       B     C    C     --soft   A       B     C\n-\t\t\t\t--mixed  A       C     C\n-\t\t\t\t--hard   C       C     C\n-\t\t\t\t--merge (disallowed)\n-\t\t\t\t--keep   A       C     C\n-\n-      working index HEAD target         working index HEAD\n-      ----------------------------------------------------\n-       B       B     C    D     --soft   B       B     D\n-\t\t\t\t--mixed  B       D     D\n-\t\t\t\t--hard   D       D     D\n-\t\t\t\t--merge  D       D     D\n-\t\t\t\t--keep  (disallowed)\n-\n-      working index HEAD target         working index HEAD\n-      ----------------------------------------------------\n-       B       B     C    C     --soft   B       B     C\n-\t\t\t\t--mixed  B       C     C\n-\t\t\t\t--hard   C       C     C\n-\t\t\t\t--merge  C       C     C\n-\t\t\t\t--keep   B       C     C\n-\n-      working index HEAD target         working index HEAD\n-      ----------------------------------------------------\n-       B       C     C    D     --soft   B       C     D\n-\t\t\t\t--mixed  B       D     D\n-\t\t\t\t--hard   D       D     D\n-\t\t\t\t--merge (disallowed)\n-\t\t\t\t--keep  (disallowed)\n-\n-      working index HEAD target         working index HEAD\n-      ----------------------------------------------------\n-       B       C     C    C     --soft   B       C     C\n-\t\t\t\t--mixed  B       C     C\n-\t\t\t\t--hard   C       C     C\n-\t\t\t\t--merge  B       C     C\n-\t\t\t\t--keep   B       C     C\n-\n-\"reset --merge\" is meant to be used when resetting out of a conflicted\n-merge. Any mergy operation guarantees that the work tree file that is\n-involved in the merge does not have local change wrt the index before\n-it starts, and that it writes the result out to the work tree. So if\n-we see some difference between the index and the target and also\n-between the index and the work tree, then it means that we are not\n-resetting out from a state that a mergy operation left after failing\n-with a conflict. That is why we disallow --merge option in this case.\n-\n-\"reset --keep\" is meant to be used when removing some of the last\n-commits in the current branch while keeping changes in the working\n-tree. If there could be conflicts between the changes in the commit we\n-want to remove and the changes in the working tree we want to keep,\n-the reset is disallowed. That's why it is disallowed if there are both\n-changes between the working tree and HEAD, and between HEAD and the\n-target. To be safe, it is also disallowed when there are unmerged\n-entries.\n-\n-The following tables show what happens when there are unmerged\n-entries:\n-\n-      working index HEAD target         working index HEAD\n-      ----------------------------------------------------\n-       X       U     A    B     --soft  (disallowed)\n-\t\t\t\t--mixed  X       B     B\n-\t\t\t\t--hard   B       B     B\n-\t\t\t\t--merge  B       B     B\n-\t\t\t\t--keep  (disallowed)\n-\n-      working index HEAD target         working index HEAD\n-      ----------------------------------------------------\n-       X       U     A    A     --soft  (disallowed)\n-\t\t\t\t--mixed  X       A     A\n-\t\t\t\t--hard   A       A     A\n-\t\t\t\t--merge  A       A     A\n-\t\t\t\t--keep  (disallowed)\n-\n-X means any state and U means an unmerged index.\n-\n-Examples\n+EXAMPLES\n --------\n \n Undo a commit and redo::\n@@ -383,6 +277,114 @@ $ git reset --keep start                    <3>\n <3> But you can use \"reset --keep\" to remove the unwanted commit after\n     you switched to \"branch2\".\n \n+\n+DISCUSSION\n+----------\n+\n+The tables below show what happens when running:\n+\n+----------\n+git reset --option target\n+----------\n+\n+to reset the HEAD to another commit (`target`) with the different\n+reset options depending on the state of the files.\n+\n+In these tables, A, B, C and D are some different states of a\n+file. For example, the first line of the first table means that if a\n+file is in state A in the working tree, in state B in the index, in\n+state C in HEAD and in state D in the target, then \"git reset --soft\n+target\" will put the file in state A in the working tree, in state B\n+in the index and in state D in HEAD.\n+\n+      working index HEAD target         working index HEAD\n+      ----------------------------------------------------\n+       A       B     C    D     --soft   A       B     D\n+\t\t\t\t--mixed  A       D     D\n+\t\t\t\t--hard   D       D     D\n+\t\t\t\t--merge (disallowed)\n+\t\t\t\t--keep  (disallowed)\n+\n+      working index HEAD target         working index HEAD\n+      ----------------------------------------------------\n+       A       B     C    C     --soft   A       B     C\n+\t\t\t\t--mixed  A       C     C\n+\t\t\t\t--hard   C       C     C\n+\t\t\t\t--merge (disallowed)\n+\t\t\t\t--keep   A       C     C\n+\n+      working index HEAD target         working index HEAD\n+      ----------------------------------------------------\n+       B       B     C    D     --soft   B       B     D\n+\t\t\t\t--mixed  B       D     D\n+\t\t\t\t--hard   D       D     D\n+\t\t\t\t--merge  D       D     D\n+\t\t\t\t--keep  (disallowed)\n+\n+      working index HEAD target         working index HEAD\n+      ----------------------------------------------------\n+       B       B     C    C     --soft   B       B     C\n+\t\t\t\t--mixed  B       C     C\n+\t\t\t\t--hard   C       C     C\n+\t\t\t\t--merge  C       C     C\n+\t\t\t\t--keep   B       C     C\n+\n+      working index HEAD target         working index HEAD\n+      ----------------------------------------------------\n+       B       C     C    D     --soft   B       C     D\n+\t\t\t\t--mixed  B       D     D\n+\t\t\t\t--hard   D       D     D\n+\t\t\t\t--merge (disallowed)\n+\t\t\t\t--keep  (disallowed)\n+\n+      working index HEAD target         working index HEAD\n+      ----------------------------------------------------\n+       B       C     C    C     --soft   B       C     C\n+\t\t\t\t--mixed  B       C     C\n+\t\t\t\t--hard   C       C     C\n+\t\t\t\t--merge  B       C     C\n+\t\t\t\t--keep   B       C     C\n+\n+\"reset --merge\" is meant to be used when resetting out of a conflicted\n+merge. Any mergy operation guarantees that the work tree file that is\n+involved in the merge does not have local change wrt the index before\n+it starts, and that it writes the result out to the work tree. So if\n+we see some difference between the index and the target and also\n+between the index and the work tree, then it means that we are not\n+resetting out from a state that a mergy operation left after failing\n+with a conflict. That is why we disallow --merge option in this case.\n+\n+\"reset --keep\" is meant to be used when removing some of the last\n+commits in the current branch while keeping changes in the working\n+tree. If there could be conflicts between the changes in the commit we\n+want to remove and the changes in the working tree we want to keep,\n+the reset is disallowed. That's why it is disallowed if there are both\n+changes between the working tree and HEAD, and between HEAD and the\n+target. To be safe, it is also disallowed when there are unmerged\n+entries.\n+\n+The following tables show what happens when there are unmerged\n+entries:\n+\n+      working index HEAD target         working index HEAD\n+      ----------------------------------------------------\n+       X       U     A    B     --soft  (disallowed)\n+\t\t\t\t--mixed  X       B     B\n+\t\t\t\t--hard   B       B     B\n+\t\t\t\t--merge  B       B     B\n+\t\t\t\t--keep  (disallowed)\n+\n+      working index HEAD target         working index HEAD\n+      ----------------------------------------------------\n+       X       U     A    A     --soft  (disallowed)\n+\t\t\t\t--mixed  X       A     A\n+\t\t\t\t--hard   A       A     A\n+\t\t\t\t--merge  A       A     A\n+\t\t\t\t--keep  (disallowed)\n+\n+X means any state and U means an unmerged index.\n+\n+\n Author\n ------\n Written by Junio C Hamano <gitster@pobox.com> and Linus Torvalds <torvalds@osdl.org>\n-- \n1.7.2.rc3.317.gc287\n"},{"id":"145773","messageId":"4d1facbcc99ee13068a00134d01c7f717369d3b9.1279477130.git.trast@student.ethz.ch","threadId":"24412","inReplyTo":"cover.1279477130.git.trast@student.ethz.ch","subject":"[PATCH v2 4/5] Documentation/reset: reorder examples to match description","fromName":"Thomas Rast","fromEmail":"trast@student.ethz.ch","sentAt":"2010-07-18T18:23:25Z","receivedAt":"2010-07-18T18:23:25Z","isPatch":true,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"A previous commit moved the <paths> mode (undoes git-add) to the front\nin the description, so make the examples follow the same order.\n\nSigned-off-by: Thomas Rast <trast@student.ethz.ch>\n---\n Documentation/git-reset.txt |   46 +++++++++++++++++++++---------------------\n 1 files changed, 23 insertions(+), 23 deletions(-)\n\ndiff --git a/Documentation/git-reset.txt b/Documentation/git-reset.txt\nindex 70198f9..1550ba2 100644\n--- a/Documentation/git-reset.txt\n+++ b/Documentation/git-reset.txt\n@@ -86,6 +86,29 @@ OPTIONS\n EXAMPLES\n --------\n \n+Undo add::\n++\n+------------\n+$ edit                                     <1>\n+$ git add frotz.c filfre.c\n+$ mailx                                    <2>\n+$ git reset                                <3>\n+$ git pull git://info.example.com/ nitfol  <4>\n+------------\n++\n+<1> You are happily working on something, and find the changes\n+in these files are in good order.  You do not want to see them\n+when you run \"git diff\", because you plan to work on other files\n+and changes with these files are distracting.\n+<2> Somebody asks you to pull, and the changes sounds worthy of merging.\n+<3> However, you already dirtied the index (i.e. your index does\n+not match the HEAD commit).  But you know the pull you are going\n+to make does not affect frotz.c nor filfre.c, so you revert the\n+index changes for these two files.  Your changes in working tree\n+remain there.\n+<4> Then you can pull and merge, leaving frotz.c and filfre.c\n+changes still in the working tree.\n+\n Undo a commit and redo::\n +\n ------------\n@@ -133,29 +156,6 @@ current HEAD.\n <2> Rewind the master branch to get rid of those three commits.\n <3> Switch to \"topic/wip\" branch and keep working.\n \n-Undo add::\n-+\n-------------\n-$ edit                                     <1>\n-$ git add frotz.c filfre.c\n-$ mailx                                    <2>\n-$ git reset                                <3>\n-$ git pull git://info.example.com/ nitfol  <4>\n-------------\n-+\n-<1> You are happily working on something, and find the changes\n-in these files are in good order.  You do not want to see them\n-when you run \"git diff\", because you plan to work on other files\n-and changes with these files are distracting.\n-<2> Somebody asks you to pull, and the changes sounds worthy of merging.\n-<3> However, you already dirtied the index (i.e. your index does\n-not match the HEAD commit).  But you know the pull you are going\n-to make does not affect frotz.c nor filfre.c, so you revert the\n-index changes for these two files.  Your changes in working tree\n-remain there.\n-<4> Then you can pull and merge, leaving frotz.c and filfre.c\n-changes still in the working tree.\n-\n Undo a merge or pull::\n +\n ------------\n-- \n1.7.2.rc3.317.gc287\n"},{"id":"145774","messageId":"81de753d1130b2e29151d67494926656af3e0cee.1279477130.git.trast@student.ethz.ch","threadId":"24412","inReplyTo":"cover.1279477130.git.trast@student.ethz.ch","subject":"[PATCH v2 5/5] Documentation/reset: move \"undo permanently\" example behind \"make topic\"","fromName":"Thomas Rast","fromEmail":"trast@student.ethz.ch","sentAt":"2010-07-18T18:23:26Z","receivedAt":"2010-07-18T18:23:26Z","isPatch":true,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"I consider the latter usage more important.\n\nSigned-off-by: Thomas Rast <trast@student.ethz.ch>\n---\n Documentation/git-reset.txt |   26 +++++++++++++-------------\n 1 files changed, 13 insertions(+), 13 deletions(-)\n\ndiff --git a/Documentation/git-reset.txt b/Documentation/git-reset.txt\nindex 1550ba2..b04d129 100644\n--- a/Documentation/git-reset.txt\n+++ b/Documentation/git-reset.txt\n@@ -128,19 +128,6 @@ edit the message further, you can give -C option instead.\n +\n See also the --amend option to linkgit:git-commit[1].\n \n-Undo commits permanently::\n-+\n-------------\n-$ git commit ...\n-$ git reset --hard HEAD~3   <1>\n-------------\n-+\n-<1> The last three commits (HEAD, HEAD^, and HEAD~2) were bad\n-and you do not want to ever see them again.  Do *not* do this if\n-you have already given these commits to somebody else.  (See the\n-\"RECOVERING FROM UPSTREAM REBASE\" section in linkgit:git-rebase[1] for\n-the implications of doing so.)\n-\n Undo a commit, making it a topic branch::\n +\n ------------\n@@ -156,6 +143,19 @@ current HEAD.\n <2> Rewind the master branch to get rid of those three commits.\n <3> Switch to \"topic/wip\" branch and keep working.\n \n+Undo commits permanently::\n++\n+------------\n+$ git commit ...\n+$ git reset --hard HEAD~3   <1>\n+------------\n++\n+<1> The last three commits (HEAD, HEAD^, and HEAD~2) were bad\n+and you do not want to ever see them again.  Do *not* do this if\n+you have already given these commits to somebody else.  (See the\n+\"RECOVERING FROM UPSTREAM REBASE\" section in linkgit:git-rebase[1] for\n+the implications of doing so.)\n+\n Undo a merge or pull::\n +\n ------------\n-- \n1.7.2.rc3.317.gc287\n"}]}