Thread (5 messages) flat view 5 messages, 3 authors, 2016-08-11
STALE3664d

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

From: Johannes Schindelin <hidden>
Date: 2016-06-15 22:42:46
Subsystem: the rest · Maintainer: Linus Torvalds

Signed-off-by: Johannes Schindelin <redacted>
---

	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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help