Skip to contentSkip to conversation

Add hints to revert documentation about other ways to undo changes

PATCH In review Tarmigan Casebolt 2 participants 6 messages Jun 15, 2016 1 message not in the archive Documentation

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive
Quoted 2 lines · Tarmigan Casebolt

I put this in a Note: in the DESCRIPTION section. If there is consensus about moving it somewhere else, I can send another patch.

I think a note in the description would be fine.

Review

Quoted 9 lines
(quoted diff) +9 -0
+Note: Despite its name, 'git revert' may not undo changes in the way
+that you expect.  If you want to throw away all uncommitted changes in
+your working directory, you should see linkgit:git-reset[1],
+particulary the '--hard' option.  If you want to extract specific
+files as they were in another commit, you should see
+linkgit:git-checkout[1], specifically the 'git checkout <commit> --
+<filename>' syntax.  Take care with these alternatives as both will
+discard uncommitted changes in your working directory.
+

The last sentence makes the paragraph incoherent, doesn't it?

By starting this paragraph with "Despite its name", you are stating your expectation that the people who find "git revert" nonintuitive are the majority. And you explain how to perform the operation that majority would expect, which is to throw away uncommitted changes to go back to the clean slate. If that is what the target audience of this paragraph expects to happen anyway, why do you need to caution against it in the last sentence?

If the answer is "because it is not cut-and-dried which expectation is the majority, and we try to be careful not to lose local modifications of users", then the tone of the paragraph needs to become more neutral.

I'd suggest either dropping the first sentence altogether and starting the paragraph with "If you want to throw away...", or replacing the first sentence with "'git revert' is used to record a new commit to reverse the effect of an earlier commit (often a faulty one)."

#2 lore raw

PATCH 1/1 Add hints to revert documentation about other ways to undo changes

Based on its name, people may read the 'git revert' documentation when they want to undo local changes, especially people who have used other SCM's. 'git revert' may not be what they had in mind, but git provides several other ways to undo changes to files. We can help them by pointing them towards the git commands that do what they might want to do.

Cc Daniel Barkalow <[email protected]>
Cc Lea Wiemann <[email protected]>

---

Quoted 1 line · Junio C Hamano

The last sentence makes the paragraph incoherent, doesn't it?

Yeah. My thinking was that the people who would appreciate this note would be newbies, and it might be nice to warn them not to just try 'git reset --hard' without thinking.

Quoted 9 lines

By starting this paragraph with "Despite its name", you are stating your expectation that the people who find "git revert" nonintuitive are the majority.

And you explain how to perform the operation that majority would expect, which is to throw away uncommitted changes to go back to the clean slate. If that is what the target audience of this paragraph expects to happen anyway, why do you need to caution against it in the last sentence?

I envision this note as useful for a majority of newbies who don't yet have a sense of everything 'git reset' and 'git checkout' can do.

Quoted 8 lines

If the answer is "because it is not cut-and-dried which expectation is the majority, and we try to be careful not to lose local modifications of users", then the tone of the paragraph needs to become more neutral.

I'd suggest either dropping the first sentence altogether and starting the paragraph with "If you want to throw away...", or replacing the first sentence with "'git revert' is used to record a new commit to reverse the effect of an earlier commit (often a faulty one)."

Good idea. I like the later option.

Thanks,
Tarmigan

 Documentation/git-revert.txt |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
Documentation/git-revert.txt +9 -0
index 98cfa3c..e578edf 100644
@@ -15,7 +15,15 @@ Given one existing commit, revert the change the patch introduces, and record a
 new commit that records it.  This requires your working tree to be clean (no
 modifications from the HEAD commit).
 
+Note: 'git revert' is used to record a new commit to reverse the
+effect of an earlier commit (often a faulty one).  If you want to
+throw away all uncommitted changes in your working directory, you
+should see linkgit:git-reset[1], particularly the '--hard' option.  If
+you want to extract specific files as they were in another commit, you
+should see linkgit:git-checkout[1], specifically the 'git checkout
+<commit> -- <filename>' syntax.  Take care with these alternatives as
+both will discard uncommitted changes in your working directory.
+
 OPTIONS
 -------
 <commit>::
Signature · 1 line
1.6.0
#3 lore raw

Documentation/git-revert.txt Given one existing commit, revert the change the patch introduces, and record a

Quoted 10 lines · Tarmigan Casebolt

Based on its name, people may read the 'git revert' documentation when
...

 Documentation/git-revert.txt |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
Documentation/git-revert.txt +0 -0
index 98cfa3c..e578edf 100644
@@ -15,7 +15,15 @@ Given one existing commit, revert the change the patch introduces, and record a

Why do you say you have 7 preimage lines and 15 postimage lines, when the diffstat claims you have 9 insertions?

Did you hand edit the diff?

author
#6 lore raw

PATCH 1/1 Add hints to revert documentation about other ways to undo changes

In reply to a message not in the archive

[Resending to git list. Original was rejected by vger with Message headers can not have 8-bit non-ASCII characters in it; Use MIME encodings if such are needed!
so trying to mail list directly for discussion. This copy is probably mangled in the forward.]

From: Tarmigan Casebolt <[email protected]>
Date: Tue, Aug 19, 2008 at 10:06 AM
Subject: [PATCH] Add hints to revert documentation about other ways to undo changes
To: [email protected]

Based on its name, people may read the 'git revert' documentation when they want to undo local changes, especially people who have used other SCM's. 'git revert' may not be what they had in mind, but git provides several other ways to undo changes to files. We can help them by pointing them towards the git commands that do what they might want to do.

Cc Daniel Barkalow <[email protected]>
Cc "Peter Valdemar Mørch (Lists)" <[email protected]>
Cc Lea Wiemann <[email protected]>

---

I put this in a Note: in the DESCRIPTION section. If there is consensus about moving it somewhere else, I can send another patch.

 Documentation/git-revert.txt |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
Documentation/git-revert.txt +0 -0
index 98cfa3c..d46f090 100644
@@ -15,6 +15,15 @@ Given one existing commit, revert the change the

patch introduces, and record a
new commit that records it. This requires your working tree to be clean (no modifications from the HEAD commit).

+Note: Despite its name, 'git revert' may not undo changes in the way +that you expect. If you want to throw away all uncommitted changes in +your working directory, you should see linkgit:git-reset[1], +particulary the '--hard' option. If you want to extract specific +files as they were in another commit, you should see +linkgit:git-checkout[1], specifically the 'git checkout <commit> -- +<filename>' syntax. Take care with these alternatives as both will +discard uncommitted changes in your working directory.
+
OPTIONS
-------
<commit>::
--
1.6.0

author
#4 lore raw
In reply to Junio C Hamano
Quoted 16 lines · Junio C Hamano

Documentation/git-revert.txt Given one existing commit, revert the change the patch introduces, and record a

Quoted 10 lines · Tarmigan Casebolt

Based on its name, people may read the 'git revert' documentation when
...

 Documentation/git-revert.txt |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
Documentation/git-revert.txt +0 -0
index 98cfa3c..e578edf 100644
@@ -15,7 +15,15 @@ Given one existing commit, revert the change the patch introduces, and record a

Why do you say you have 7 preimage lines and 15 postimage lines, when the diffstat claims you have 9 insertions?

Quoted 2 lines

Did you hand edit the diff?

Oops, sorry about that. I did hand edit the diff because at the last second I saw a typo (particulary --> particularly), but I had already written the email so I didn't want to do format-patch again. I did not rewrap, nor did I manually change the 6 to a 7. I did use emacs though, which, when I tried to recreate it right now, seems to change the 6 to a 7 when I touch any of the changed lines.

Sorry about that. I will turn off emacs diff mode and try to be more careful next time. Please let me know if you want me to resend.

Thanks,
Tarmigan

#5 lore raw
Quoted 7 lines · Tarmigan

On Wed, Aug 20, 2008 at 4:06 PM, Junio C Hamano <[email protected]> wrote:
..

Quoted 2 lines

Did you hand edit the diff?

... I did use emacs
though, which, when I tried to recreate it right now, seems to change the 6 to a 7 when I touch any of the changed lines.

Ok, I was not complaining, just being curious.

Recounting by Emacs's diff mode is sort of broken (it is not quite broken, but it could do better). My primary interest in the question was to to see if you are using some other broken diff editing environment.