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

[PATCH] git-reset --hard: tell the user what the HEAD was reset to

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Dec 21, 2006, 14:26 UTC
Message-ID
<Pine.LNX.4.63.0612211525070.19693@wbgn013.biozentrum.uni-wuerzburg.de>
In-Reply-To
<emcf17$esj$1@sea.gmane.org>
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
---
	On Wed, 20 Dec 2006, Han-Wen Nienhuys wrote:
	> It would be nice if git-reset printed 
	> 
	>  HEAD is now <sha1> - <excerpt of commit message>
	This patch does that, but only for --reset.
	Without reset, HEAD is _not_ changed, just the contents of the
	working directory and/or the index.
 git-reset.sh |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/git-reset.sh b/git-reset.sh
index 8d95e37..2379db0 100755
--- a/git-reset.sh
+++ b/git-reset.sh
@@ -86,7 +86,12 @@ update_ref_status=$?
 
 case "$reset_type" in
 --hard )
-	;; # Nothing else to do
+	test $update_ref_status = 0 && {
+		echo -n "HEAD is now at "
+		GIT_PAGER= git log --max-count=1 --pretty=oneline \
+			--abbrev-commit HEAD
+	}
+	;;
 --soft )
 	;; # Nothing else to do
 --mixed )
-- 
1.4.4.3.gdb8fb-dirty
Previous: Han-Wen NienhuysNext: Andy Whitcroft
Message 2 of 5 in “UI nitpick”
  1. Han-Wen NienhuysDec 20, 2006
  2. git-reset --hard: tell the user what the HEAD was reset toJohannes Schindelin, Dec 21, 2006
  3. Andy WhitcroftJan 3, 2007
  4. Johannes SchindelinJan 4, 2007
  5. Andy WhitcroftJan 4, 2007

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.