aboutsummaryrefslogtreecommitdiff
path: root/git-orig
blob: a7923908df4b18a302f0f4b56d6539e8bcab1df0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/sh

# git-orig -- checkout original file

[ $# -lt 2 ] && { echo "usage: $0 head file [...]" 1>&2; exit 1; }

h=$1
shift
set -e

for f in "$@"; do
	mv -i "$f" "$f".new
done

git checkout "$h" -- "$@"

for f in "$@"; do
	mv -i "$f" "$f".orig
	mv "$f".new "$f"
done