1
0
mirror of https://github.com/git/git.git synced 2024-09-30 13:42:06 +02:00
git/git-reset-script
Junio C Hamano 32173e6988 Stash away the original head in ORIG_HEAD when resetting.
When rewinding the head, stash away the value of the original
HEAD in ORIG_HEAD, just like git-resolve-script does.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-08-09 23:38:49 -07:00

14 lines
407 B
Bash
Executable File

#!/bin/sh
. git-sh-setup-script || die "Not a git archive"
rev=$(git-rev-parse --revs-only --verify --default HEAD "$@") || exit
rev=$(git-rev-parse --revs-only --verify $rev^0) || exit
git-read-tree --reset "$rev" && {
if orig=$(git-rev-parse --verify HEAD 2>/dev/null)
then
echo "$orig" >"$GIT_DIR/ORIG_HEAD"
fi
echo "$rev" > "$GIT_DIR/HEAD"
}
git-update-cache --refresh
rm -f "$GIT_DIR/MERGE_HEAD"