Code

Merge branch 'ph/maint-quiltimport' into maint
[git.git] / git-checkout.sh
index f6d58ac044e5afb09855d687d3c1bcc8e2273be3..bd74d701a1f0abb63e2bcdcb47035cb2c6eee745 100755 (executable)
@@ -2,13 +2,13 @@
 
 OPTIONS_KEEPDASHDASH=t
 OPTIONS_SPEC="\
-git-branch [options] [<branch>] [<paths>...]
+git-checkout [options] [<branch>] [<paths>...]
 --
 b=          create a new branch started at <branch>
-l           create the new branchs reflog
-track       tells if the new branch should track the remote branch
+l           create the new branch's reflog
+track       arrange that the new branch tracks the remote branch
 f           proceed even if the index or working tree is not HEAD
-m           performa  three-way merge on local modifications if needed
+m           merge local modifications into the new branch
 q,quiet     be quiet
 "
 SUBDIRECTORY_OK=Sometimes
@@ -71,7 +71,8 @@ while test $# != 0; do
 done
 
 arg="$1"
-if rev=$(git rev-parse --verify "$arg^0" 2>/dev/null)
+rev=$(git rev-parse --verify "$arg" 2>/dev/null)
+if rev=$(git rev-parse --verify "$rev^0" 2>/dev/null)
 then
        [ -z "$rev" ] && die "unknown flag $arg"
        new_name="$arg"
@@ -82,11 +83,11 @@ then
        fi
        new="$rev"
        shift
-elif rev=$(git rev-parse --verify "$arg^{tree}" 2>/dev/null)
+elif rev=$(git rev-parse --verify "$rev^{tree}" 2>/dev/null)
 then
        # checking out selected paths from a tree-ish.
        new="$rev"
-       new_name="$arg^{tree}"
+       new_name="$rev^{tree}"
        shift
 fi
 [ "$1" = "--" ] && shift