aboutsummaryrefslogtreecommitdiff
path: root/git-reset-script
blob: 7da8d86823b09a6fa9a5c5d28dcc849253843181 (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 --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"