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

[PATCH] builtin-reset.c: Extend hard reset error message when using paths.

From
TRTim Retout <tim@retout.co.uk>
Date
Apr 13, 2009, 18:14 UTC
Message-ID
<1239646444-11653-1-git-send-email-tim@retout.co.uk>

Users who invoke 'git reset --hard <paths>' are probably trying to update paths in their working directory. The error message should point them in the direction of git-checkout(1).

Signed-off-by: Tim Retout <tim@retout.co.uk>
---
 builtin-reset.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/builtin-reset.c b/builtin-reset.c
index c0cb915..885ca9a 100644
--- a/builtin-reset.c
+++ b/builtin-reset.c
@@ -257,6 +257,10 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
 	if (i < argc) {
 		if (reset_type == MIXED)
 			warning("--mixed option is deprecated with paths.");
+		else if (reset_type == HARD)
+			die("Cannot do %s reset with paths.\n"
+			    "See git-checkout(1) to update paths in the working tree.",
+					reset_type_names[reset_type]);
 		else if (reset_type != NONE)
 			die("Cannot do %s reset with paths.",
 					reset_type_names[reset_type]);
-- 
1.6.2.2
Next: Junio C Hamano
Message 1 of 4 in “builtin-reset.c: Extend hard reset error message when using paths.”
  1. builtin-reset.c: Extend hard reset error message when using paths.Tim Retout, Apr 13, 2009
  2. Junio C HamanoApr 13, 2009
  3. Tim RetoutApr 13, 2009
  4. Jeff KingApr 14, 2009

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.