summaryrefslogtreecommitdiff
path: root/git-reset-script
diff options
context:
space:
mode:
Diffstat (limited to 'git-reset-script')
-rwxr-xr-xgit-reset-script4
1 files changed, 3 insertions, 1 deletions
diff --git a/git-reset-script b/git-reset-script
index 0c02aa6..b6476ed 100755
--- a/git-reset-script
+++ b/git-reset-script
@@ -1,5 +1,7 @@
#!/bin/sh
. git-sh-setup-script || die "Not a git archive"
-git-read-tree --reset HEAD
+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" && echo "$rev" > "$GIT_DIR/HEAD"
git-update-cache --refresh
rm -f "$GIT_DIR/MERGE_HEAD"