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

[RFC PATCH 2/2] wt-status: Teach how to discard changes in the working directory

From
AMAnders Melchiorsen <mail@cup.kalibalik.dk>
Date
Sep 7, 2008, 22:05 UTC
Message-ID
<1220825103-19599-3-git-send-email-mail@cup.kalibalik.dk>
In-Reply-To
<1220825103-19599-2-git-send-email-mail@cup.kalibalik.dk>
This is a question that comes up a lot in #git.
---
 t/t7502-status.sh |   10 ++++++++++
 wt-status.c       |    1 +
 2 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/wt-status.c b/wt-status.c
index ceb3a1e..5bc3e36 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -80,6 +80,7 @@ static void wt_status_print_dirty_header(struct wt_status *s,
 	} else {
 		color_fprintf_ln(s->fp, c, "#   (use \"git add/rm <file>...\" to update what will be committed)");
 	}
+	color_fprintf_ln(s->fp, c, "#   (use \"git checkout -- <file>...\" to discard changes in working directory)");
 	color_fprintf_ln(s->fp, c, "#");
 }
 
diff --git a/t/t7502-status.sh b/t/t7502-status.sh
index 38a48b5..efa1239 100755
--- a/t/t7502-status.sh
+++ b/t/t7502-status.sh
@@ -46,6 +46,7 @@ cat > expect << \EOF
 #
 # Changed but not updated:
 #   (use "git add <file>..." to update what will be committed)
+#   (use "git checkout -- <file>..." to discard changes in working directory)
 #
 #	modified:   dir1/modified
 #
@@ -76,6 +77,7 @@ cat >expect <<EOF
 #
 # Changed but not updated:
 #   (use "git add <file>..." to update what will be committed)
+#   (use "git checkout -- <file>..." to discard changes in working directory)
 #
 #	modified:   dir1/modified
 #
@@ -104,6 +106,7 @@ cat >expect <<EOF
 #
 # Changed but not updated:
 #   (use "git add <file>..." to update what will be committed)
+#   (use "git checkout -- <file>..." to discard changes in working directory)
 #
 #	modified:   dir1/modified
 #
@@ -138,6 +141,7 @@ cat >expect <<EOF
 #
 # Changed but not updated:
 #   (use "git add <file>..." to update what will be committed)
+#   (use "git checkout -- <file>..." to discard changes in working directory)
 #
 #	modified:   dir1/modified
 #
@@ -174,6 +178,7 @@ cat > expect << \EOF
 #
 # Changed but not updated:
 #   (use "git add <file>..." to update what will be committed)
+#   (use "git checkout -- <file>..." to discard changes in working directory)
 #
 #	modified:   modified
 #
@@ -204,6 +209,7 @@ cat > expect << \EOF
 #
 # Changed but not updated:
 #   (use "git add <file>..." to update what will be committed)
+#   (use "git checkout -- <file>..." to discard changes in working directory)
 #
 #	modified:   dir1/modified
 #
@@ -267,6 +273,7 @@ cat >expect <<EOF
 #
 # Changed but not updated:
 #   (use "git add <file>..." to update what will be committed)
+#   (use "git checkout -- <file>..." to discard changes in working directory)
 #
 #	modified:   dir1/modified
 #
@@ -297,6 +304,7 @@ cat >expect <<EOF
 #
 # Changed but not updated:
 #   (use "git add <file>..." to update what will be committed)
+#   (use "git checkout -- <file>..." to discard changes in working directory)
 #
 #	modified:   dir1/modified
 #
@@ -326,6 +334,7 @@ cat >expect <<EOF
 # On branch master
 # Changed but not updated:
 #   (use "git add <file>..." to update what will be committed)
+#   (use "git checkout -- <file>..." to discard changes in working directory)
 #
 #	modified:   dir1/modified
 #
@@ -357,7 +366,7 @@ cat >expect <<EOF
 #
 # Changed but not updated:
 #   (use "git add <file>..." to update what will be committed)
+#   (use "git checkout -- <file>..." to discard changes in working directory)
 #
 #	modified:   dir1/modified
 #
-- 
1.6.0.1.dirty
Previous: Anders MelchiorsenNext: Junio C Hamano
Message 3 of 6 in “Teach how to discard changes in the working directory”
  1. 0/2 Teach how to discard changes in the working directoryAnders Melchiorsen, Sep 7, 2008
  2. 1/2 wt-status: Split header generation into three functionsAnders Melchiorsen, Sep 7, 2008
  3. 2/2 wt-status: Teach how to discard changes in the working directoryAnders Melchiorsen, Sep 7, 2008
  4. Junio C HamanoSep 7, 2008
  5. Pieter de BieSep 7, 2008
  6. Junio C HamanoSep 7, 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.