aboutsummaryrefslogtreecommitdiff
path: root/git-reset-script
blob: 49994df7a2329a87a65588be94088198d208ba1a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/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"