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

[PATCH] git-reset: make the output as the fetch output

From
SBSanti Béjar <sbejar@gmail.com>
Date
Jan 17, 2007, 12:56 UTC
Message-ID
<87odox23u9.fsf@gmail.com>
... and only when HEAD is changed.
Signed-off-by: Santi Béjar <sbejar@gmail.com>
---
 git-reset.sh |   19 +++++++++++++------
 1 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/git-reset.sh b/git-reset.sh
index bf2a058..acefddc 100755
--- a/git-reset.sh
+++ b/git-reset.sh
@@ -24,6 +24,7 @@ do
 		usage
 		;;
 	*)
+		commit="$1"
 		rev=$(git-rev-parse --verify "$1") || exit
 		shift
 		break
@@ -84,14 +85,20 @@ fi
 git-update-ref -m "$GIT_REFLOG_ACTION" HEAD "$rev"
 update_ref_status=$?
 
+if test $update_ref_status = 0 && test "$orig" != "$rev"
+then
+    revshort=$(git-rev-parse --short $rev)
+    echo "* HEAD: reset to $commit"
+    if test "$orig" ; then
+	echo "  old..new: $(git-rev-parse --short $orig)..$revshort"
+    else
+	echo "  commit: $revshort"
+    fi
+fi
+
 case "$reset_type" in
 --hard )
-	test $update_ref_status = 0 && {
-		printf "HEAD is now at "
-		GIT_PAGER= git log --max-count=1 --pretty=oneline \
-			--abbrev-commit HEAD
-	}
-	;;
+	;; # Nothing else to do
 --soft )
 	;; # Nothing else to do
 --mixed )
-- 
1.5.0.rc1.g0dee5
Next: Santi Béjar
Message 1 of 6 in “git-reset: make the output as the fetch output”
  1. git-reset: make the output as the fetch outputSanti Béjar, Jan 17, 2007
  2. Santi BéjarJan 17, 2007
  3. YOSHIFUJI Hideaki / 吉藤英明Jan 17, 2007
  4. Andy ParkinsJan 17, 2007
  5. Johannes SchindelinJan 17, 2007
  6. Johannes SchindelinJan 17, 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.