3 old=$(git-rev-parse HEAD)
7 while [ "$#" != "0" ]; do
15 rev=$(git-rev-parse "$arg")
16 if [ -z "$rev" ]; then
17 echo "unknown flag $arg"
21 echo "Multiple revisions?"
25 if [ -f "$GIT_DIR/refs/heads/$arg" ]; then
32 [ -z "$new" ] && new=$old
36 git-read-tree --reset $new &&
37 git-checkout-cache -q -f -u -a
39 git-read-tree -m -u $old $new
43 # Switch the HEAD pointer to the new branch if it we
44 # checked out a branch head, and remove any potential
45 # old MERGE_HEAD's (subsequent commits will clearly not
46 # be based on them, since we re-set the index)
48 if [ "$?" -eq 0 ]; then
49 [ "$branch" ] && ln -sf "refs/heads/$branch" "$GIT_DIR/HEAD"
50 rm -f "$GIT_DIR/MERGE_HEAD"