summaryrefslogtreecommitdiff
path: root/git-reset-script
diff options
context:
space:
mode:
Diffstat (limited to 'git-reset-script')
-rwxr-xr-xgit-reset-script13
1 files changed, 13 insertions, 0 deletions
diff --git a/git-reset-script b/git-reset-script
new file mode 100755
index 0000000000..7da8d86823
--- /dev/null
+++ b/git-reset-script
@@ -0,0 +1,13 @@
+#!/bin/sh
+. git-sh-setup-script || die "Not a git archive"
+rev=$(git-rev-parse --verify --default HEAD "$@") || exit
+rev=$(git-rev-parse --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"