git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Add hints to revert documentation about other ways to undo changes

From
TTarmigan <tarmigan+git@gmail.com>
Date
Aug 19, 2008, 17:06 UTC
Message-ID
<905315640808191006y6defa44fu2fdd41c034ffc263@mail.gmail.com>
In-Reply-To
<1219165591-19969-1-git-send-email-tarmigan+git@gmail.com>

[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 <tarmigan+git@gmail.com>
Date: Tue, Aug 19, 2008 at 10:06 AM
Subject: [PATCH] Add hints to revert documentation about other ways to
undo changes
To: gitster@pobox.com

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 <barkalow@iabervon.org>
Cc: "Peter Valdemar Mørch (Lists)" <4ux6as402@sneakemail.com>
Cc: Lea Wiemann <lewiemann@gmail.com>
Signed-off-by: Tarmigan Casebolt <tarmigan+git@gmail.com>
---

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(-)
diff --git a/Documentation/git-revert.txt b/Documentation/git-revert.txt
index 98cfa3c..d46f090 100644
--- a/Documentation/git-revert.txt
+++ b/Documentation/git-revert.txt
@@ -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
Next: Junio C Hamano
Message 1 of 6 in “Add hints to revert documentation about other ways to undo changes”
  1. Add hints to revert documentation about other ways to undo changesTarmigan, Aug 19, 2008
  2. Junio C HamanoAug 19, 2008
  3. Add hints to revert documentation about other ways to undo changesTarmigan Casebolt, Aug 19, 2008
  4. Junio C HamanoAug 20, 2008
  5. TarmiganAug 20, 2008
  6. Junio C HamanoAug 20, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.