3 # git-subtree.sh: split/join git repositories in subdirectories of this one
5 # Copyright (C) 2009 Avery Pennarun <apenwarr@gmail.com>
8 if test -z "$GIT_EXEC_PATH" ||
! test -f "$GIT_EXEC_PATH/git-sh-setup" ||
{
9 test "${PATH#"${GIT_EXEC_PATH}:"}" = "$PATH" &&
10 test ! "$GIT_EXEC_PATH" -ef "${PATH%%:*}" 2>/dev
/null
14 echo >&2 'It looks like either your git installation or your'
15 echo >&2 'git-subtree installation is broken.'
18 echo >&2 " - If \`git --exec-path\` does not print the correct path to"
19 echo >&2 " your git install directory, then set the GIT_EXEC_PATH"
20 echo >&2 " environment variable to the correct directory."
21 echo >&2 " - Make sure that your \`$basename\` file is either in your"
22 echo >&2 " PATH or in your git exec path (\`$(git --exec-path)\`)."
23 echo >&2 " - You should run git-subtree as \`git ${basename#git-}\`,"
24 echo >&2 " not as \`$basename\`." >&2
29 git subtree add --prefix=<prefix> [-S[=<key-id>]] <commit>
30 git subtree add --prefix=<prefix> [-S[=<key-id>]] <repository> <ref>
31 git subtree merge --prefix=<prefix> [-S[=<key-id>]] <commit>
32 git subtree split --prefix=<prefix> [-S[=<key-id>]] [<commit>]
33 git subtree pull --prefix=<prefix> [-S[=<key-id>]] <repository> <ref>
34 git subtree push --prefix=<prefix> [-S[=<key-id>]] <repository> <refspec>
38 d,debug! show debug messages
39 P,prefix= the name of the subdir to split out
40 options for 'split' (also: 'push')
41 annotate= add a prefix to commit message of new commits
42 b,branch!= create a new branch from the split subtree
43 ignore-joins ignore prior --rejoin commits
44 onto= try connecting new tree to an existing one
45 rejoin merge the new branch back into HEAD
46 options for 'add' and 'merge' (also: 'pull', 'split --rejoin', and 'push --rejoin')
47 squash merge subtree changes as a single commit
48 m,message!= use the given message as the commit message for the merge commit
49 S,gpg-sign?key-id GPG-sign commits. The keyid argument is optional and defaults to the committer identity
56 if test -z "$arg_quiet"
62 # Usage: debug [MSG...]
64 if test -n "$arg_debug"
66 printf "%$(($indent * 2))s%s\n" '' "$*" >&2
70 # Usage: progress [MSG...]
72 if test -z "$arg_quiet"
74 if test -z "$arg_debug"
78 # Print one progress line that we keep updating (use
79 # "\r" to return to the beginning of the line, rather
80 # than "\n" to start a new line). This only really
81 # works when stderr is a terminal.
82 printf "%s\r" "$*" >&2
84 # Debug mode is on. The `debug` function is regularly
87 # Don't do the one-line-with-"\r" thing, because on a
88 # terminal the debug output would overwrite and hide the
89 # progress output. Add a "progress:" prefix to make the
90 # progress output and the debug output easy to
91 # distinguish. This ensures maximum readability whether
92 # stderr is a terminal or a file.
93 printf "progress: %s\n" "$*" >&2
98 # Usage: assert CMD...
102 die
"fatal: assertion failed: $*"
106 # Usage: die_incompatible_opt OPTION COMMAND
107 die_incompatible_opt
() {
111 die
"fatal: the '$opt' flag does not make sense with 'git subtree $arg_command'."
119 set_args
="$(echo "$OPTS_SPEC" | git rev-parse --parseopt --stuck-long -- "$@
" || echo exit $?)"
124 # First figure out the command and whether we use --rejoin, so
125 # that we can provide more helpful validation when we do the
126 # "real" flag parsing.
147 case "$arg_command" in
153 allow_addmerge
=$arg_split_rejoin
156 die
"fatal: unknown command '$arg_command'"
159 # Reset the arguments array for "real" flag parsing.
162 # Begin "real" flag parsing.
168 arg_split_ignore_joins
=
171 arg_addmerge_message
=
186 test -n "$allow_split" || die_incompatible_opt
"$opt" "$arg_command"
187 arg_split_annotate
="${opt#*=}"
190 test -n "$allow_split" || die_incompatible_opt
"$opt" "$arg_command"
194 test -n "$allow_split" || die_incompatible_opt
"$opt" "$arg_command"
195 arg_split_branch
="${opt#*=}"
198 arg_prefix
="${opt#*=}"
201 test -n "$allow_addmerge" || die_incompatible_opt
"$opt" "$arg_command"
202 arg_addmerge_message
="${opt#*=}"
208 test -n "$allow_split" || die_incompatible_opt
"$opt" "$arg_command"
209 arg_split_onto
="${opt#*=}"
212 test -n "$allow_split" || die_incompatible_opt
"$opt" "$arg_command"
216 test -n "$allow_split" || die_incompatible_opt
"$opt" "$arg_command"
219 test -n "$allow_split" || die_incompatible_opt
"$opt" "$arg_command"
222 test -n "$allow_split" || die_incompatible_opt
"$opt" "$arg_command"
223 arg_split_ignore_joins
=1
226 test -n "$allow_split" || die_incompatible_opt
"$opt" "$arg_command"
227 arg_split_ignore_joins
=
230 test -n "$allow_addmerge" || die_incompatible_opt
"$opt" "$arg_command"
231 arg_addmerge_squash
=1
234 test -n "$allow_addmerge" || die_incompatible_opt
"$opt" "$arg_command"
237 --gpg-sign=* |
--gpg-sign |
--no-gpg-sign)
244 die
"fatal: unexpected option: $opt"
250 if test -z "$arg_prefix"
252 die
"fatal: you must provide the --prefix option."
255 case "$arg_command" in
257 test -e "$arg_prefix" &&
258 die
"fatal: prefix '$arg_prefix' already exists."
261 test -e "$arg_prefix" ||
262 die
"fatal: '$arg_prefix' does not exist; use 'git subtree add'"
266 dir
="$(dirname "$arg_prefix/.
")"
268 debug
"command: {$arg_command}"
269 debug
"quiet: {$arg_quiet}"
272 debug
"gpg-sign: {$arg_gpg_sign}"
275 "cmd_$arg_command" "$@"
281 cachedir
="$GIT_DIR/subtree-cache/$$"
282 rm -rf "$cachedir" ||
283 die
"fatal: can't delete old cachedir: $cachedir"
284 mkdir
-p "$cachedir" ||
285 die
"fatal: can't create new cachedir: $cachedir"
286 mkdir
-p "$cachedir/notree" ||
287 die
"fatal: can't create new cachedir: $cachedir/notree"
288 debug
"Using cachedir: $cachedir" >&2
291 # Usage: cache_get [REVS...]
295 if test -r "$cachedir/$oldrev"
297 read newrev
<"$cachedir/$oldrev"
303 # Usage: cache_miss [REVS...]
307 if ! test -r "$cachedir/$oldrev"
314 # Usage: check_parents [REVS...]
316 missed
=$
(cache_miss
"$@") ||
exit $?
317 local indent
=$
(($indent + 1))
320 if ! test -r "$cachedir/notree/$miss"
322 debug
"incorrect order: $miss"
323 process_split_commit
"$miss" ""
328 # Usage: set_notree REV
331 echo "1" > "$cachedir/notree/$1"
334 # Usage: cache_set OLDREV NEWREV
339 if test "$oldrev" != "latest_old" &&
340 test "$oldrev" != "latest_new" &&
341 test -e "$cachedir/$oldrev"
343 die
"fatal: cache for $oldrev already exists!"
345 echo "$newrev" >"$cachedir/$oldrev"
348 # Usage: rev_exists REV
351 if git rev-parse
"$1" >/dev
/null
2>&1
359 # Usage: try_remove_previous REV
361 # If a commit doesn't have a parent, this might not work. But we only want
362 # to remove the parent from the rev-list, and since it doesn't exist, it won't
363 # be there anyway, so do nothing in that case.
364 try_remove_previous
() {
372 # Usage: process_subtree_split_trailer SPLIT_HASH MAIN_HASH [REPOSITORY]
373 process_subtree_split_trailer
() {
383 fail_msg
="fatal: could not rev-parse split hash $b from commit $sq"
384 if ! sub
="$(git rev-parse --verify --quiet "$b^
{commit
}")"
386 # if 'repository' was given, try to fetch the 'git-subtree-split' hash
387 # before 'rev-parse'-ing it again, as it might be a tag that we do not have locally
388 if test -n "${repository}"
390 git fetch
"$repository" "$b"
391 sub
="$(git rev-parse --verify --quiet "$b^
{commit
}")" ||
394 hint1
=$
(printf "hint: hash might be a tag, try fetching it from the subtree repository:")
395 hint2
=$
(printf "hint: git fetch <subtree-repository> $b")
396 fail_msg
=$
(printf "$fail_msg\n$hint1\n$hint2")
402 # Usage: find_latest_squash DIR [REPOSITORY]
403 find_latest_squash
() {
412 debug
"Looking for latest squash (dir=$dir, repository=$repository)..."
413 local indent
=$
(($indent + 1))
418 git log
--grep="^git-subtree-dir: $dir/*\$" \
419 --no-show-signature --pretty=format
:'START %H%n%s%n%n%b%nEND%n' HEAD |
423 debug
"{{$sq/$main/$sub}}"
428 git-subtree-mainline
:)
432 process_subtree_split_trailer
"$b" "$sq" "$repository"
440 # Pretend its sub was a squash.
441 sq=$
(git rev-parse
--verify "$sq^2") ||
444 debug
"Squash found: $sq $sub"
456 # Usage: find_existing_splits DIR REV [REPOSITORY]
457 find_existing_splits
() {
460 debug
"Looking for prior splits..."
461 local indent
=$
(($indent + 1))
472 local grep_format
="^git-subtree-dir: $dir/*\$"
473 if test -n "$arg_split_ignore_joins"
475 grep_format
="^Add '$dir/' from commit '"
477 git log
--grep="$grep_format" \
478 --no-show-signature --pretty=format
:'START %H%n%s%n%n%b%nEND%n' "$rev" |
485 git-subtree-mainline
:)
489 process_subtree_split_trailer
"$b" "$sq" "$repository"
492 debug
"Main is: '$main'"
493 if test -z "$main" && test -n "$sub"
495 # squash commits refer to a subtree
496 debug
" Squash: $sq from $sub"
497 cache_set
"$sq" "$sub"
499 if test -n "$main" && test -n "$sub"
501 debug
" Prior: $main -> $sub"
504 try_remove_previous
"$main"
505 try_remove_previous
"$sub"
514 # Usage: copy_commit REV TREE FLAGS_STR
517 # We're going to set some environment vars here, so
518 # do it in a subshell to get rid of them safely later
519 debug copy_commit
"{$1}" "{$2}" "{$3}"
520 git log
-1 --no-show-signature --pretty=format
:'%an%n%ae%n%aD%n%cn%n%ce%n%cD%n%B' "$1" |
523 read GIT_AUTHOR_EMAIL
525 read GIT_COMMITTER_NAME
526 read GIT_COMMITTER_EMAIL
527 read GIT_COMMITTER_DATE
528 export GIT_AUTHOR_NAME \
532 GIT_COMMITTER_EMAIL \
535 printf "%s" "$arg_split_annotate"
538 git commit-tree
$arg_gpg_sign "$2" $3 # reads the rest of stdin
539 ) || die
"fatal: can't copy commit $1"
542 # Usage: add_msg DIR LATEST_OLD LATEST_NEW
548 if test -n "$arg_addmerge_message"
550 commit_message
="$arg_addmerge_message"
552 commit_message
="Add '$dir/' from commit '$latest_new'"
554 if test -n "$arg_split_rejoin"
556 # If this is from a --rejoin, then rejoin_msg has
557 # already inserted the `git-subtree-xxx:` tags
558 echo "$commit_message"
564 git-subtree-dir: $dir
565 git-subtree-mainline: $latest_old
566 git-subtree-split: $latest_new
570 # Usage: add_squashed_msg REV DIR
571 add_squashed_msg
() {
573 if test -n "$arg_addmerge_message"
575 echo "$arg_addmerge_message"
577 echo "Merge commit '$1' as '$2'"
581 # Usage: rejoin_msg DIR LATEST_OLD LATEST_NEW
587 if test -n "$arg_addmerge_message"
589 commit_message
="$arg_addmerge_message"
591 commit_message
="Split '$dir/' into commit '$latest_new'"
596 git-subtree-dir: $dir
597 git-subtree-mainline: $latest_old
598 git-subtree-split: $latest_new
602 # Usage: squash_msg DIR OLD_SUBTREE_COMMIT NEW_SUBTREE_COMMIT
608 newsub_short
=$
(git rev-parse
--short "$newsub")
612 oldsub_short
=$
(git rev-parse
--short "$oldsub")
613 echo "Squashed '$dir/' changes from $oldsub_short..$newsub_short"
615 git log
--no-show-signature --pretty=tformat
:'%h %s' "$oldsub..$newsub"
616 git log
--no-show-signature --pretty=tformat
:'REVERT: %h %s' "$newsub..$oldsub"
618 echo "Squashed '$dir/' content from commit $newsub_short"
622 echo "git-subtree-dir: $dir"
623 echo "git-subtree-split: $newsub"
626 # Usage: toptree_for_commit COMMIT
627 toptree_for_commit
() {
630 git rev-parse
--verify "$commit^{tree}" ||
exit $?
633 # Usage: subtree_for_commit COMMIT DIR
634 subtree_for_commit
() {
638 git ls-tree
"$commit" -- "$dir" |
639 while read mode
type tree name
641 assert
test "$name" = "$dir"
645 continue;; # ignore submodules
650 die
"fatal: tree entry is of type ${type}, expected tree or commit";;
655 # Usage: tree_changed TREE [PARENTS...]
662 return 0 # weird parents, consider it changed
664 ptree
=$
(toptree_for_commit
$1) ||
exit $?
665 if test "$ptree" != "$tree"
669 return 1 # not changed
674 # Usage: new_squash_commit OLD_SQUASHED_COMMIT OLD_NONSQUASHED_COMMIT NEW_NONSQUASHED_COMMIT
675 new_squash_commit
() {
680 tree
=$
(toptree_for_commit
$newsub) ||
exit $?
683 squash_msg
"$dir" "$oldsub" "$newsub" |
684 git commit-tree
$arg_gpg_sign "$tree" -p "$old" ||
exit $?
686 squash_msg
"$dir" "" "$newsub" |
687 git commit-tree
$arg_gpg_sign "$tree" ||
exit $?
691 # Usage: copy_or_skip REV TREE NEWPARENTS
697 assert
test -n "$tree"
704 for parent
in $newparents
706 ptree
=$
(toptree_for_commit
$parent) ||
exit $?
707 test -z "$ptree" && continue
708 if test "$ptree" = "$tree"
710 # an identical parent could be used in place of this rev.
711 if test -n "$identical"
713 # if a previous identical parent was found, check whether
714 # one is already an ancestor of the other
715 mergebase
=$
(git merge-base
$identical $parent)
716 if test "$identical" = "$mergebase"
718 # current identical commit is an ancestor of parent
720 elif test "$parent" != "$mergebase"
722 # no common history; commit must be copied
726 # first identical parent detected
730 nonidentical
="$parent"
733 # sometimes both old parents map to the same newparent;
734 # eliminate duplicates
736 for gp
in $gotparents
738 if test "$gp" = "$parent"
746 gotparents
="$gotparents $parent"
751 if test -n "$identical" && test -n "$nonidentical"
753 extras
=$
(git rev-list
--count $identical..
$nonidentical)
754 if test "$extras" -ne 0
756 # we need to preserve history along the other branch
760 if test -n "$identical" && test -z "$copycommit"
764 copy_commit
"$rev" "$tree" "$p" ||
exit $?
768 # Usage: ensure_clean
771 if ! git diff-index HEAD
--exit-code --quiet 2>&1
773 die
"fatal: working tree has modifications. Cannot add."
775 if ! git diff-index
--cached HEAD
--exit-code --quiet 2>&1
777 die
"fatal: index has modifications. Cannot add."
781 # Usage: ensure_valid_ref_format REF
782 ensure_valid_ref_format
() {
784 git check-ref-format
"refs/heads/$1" ||
785 die
"fatal: '$1' does not look like a ref"
788 # Usage: check if a commit from another subtree should be
789 # ignored from processing for splits
790 should_ignore_subtree_split_commit
() {
793 if test -n "$(git log -1 --grep="git-subtree-dir
:" $rev)"
795 if test -z "$(git log -1 --grep="git-subtree-mainline
:" $rev)" &&
796 test -z "$(git log -1 --grep="git-subtree-dir
: $arg_prefix$
" $rev)"
804 # Usage: process_split_commit REV PARENTS
805 process_split_commit
() {
810 if test $indent -eq 0
812 revcount
=$
(($revcount + 1))
814 # processing commit without normal parent information;
816 parents
=$
(git rev-parse
"$rev^@")
817 extracount
=$
(($extracount + 1))
820 progress
"$revcount/$revmax ($createcount) [$extracount]"
822 debug
"Processing commit: $rev"
823 local indent
=$
(($indent + 1))
824 exists
=$
(cache_get
"$rev") ||
exit $?
827 debug
"prior: $exists"
830 createcount
=$
(($createcount + 1))
831 debug
"parents: $parents"
832 check_parents
$parents
833 newparents
=$
(cache_get
$parents) ||
exit $?
834 debug
"newparents: $newparents"
836 tree
=$
(subtree_for_commit
"$rev" "$dir") ||
exit $?
837 debug
"tree is: $tree"
839 # ugly. is there no better way to tell if this is a subtree
840 # vs. a mainline commit? Does it matter?
844 if test -n "$newparents"
846 cache_set
"$rev" "$rev"
851 newrev
=$
(copy_or_skip
"$rev" "$tree" "$newparents") ||
exit $?
852 debug
"newrev is: $newrev"
853 cache_set
"$rev" "$newrev"
854 cache_set latest_new
"$newrev"
855 cache_set latest_old
"$rev"
859 # Or: cmd_add REPOSITORY REF
866 git rev-parse
-q --verify "$1^{commit}" >/dev
/null ||
867 die
"fatal: '$1' does not refer to a commit"
873 # Technically we could accept a refspec here but we're
874 # just going to turn around and add FETCH_HEAD under the
875 # specified directory. Allowing a refspec might be
876 # misleading because we won't do anything with any other
877 # branches fetched via the refspec.
878 ensure_valid_ref_format
"$2"
880 cmd_add_repository
"$@"
882 say
>&2 "fatal: parameters were '$*'"
883 die
"Provide either a commit or a repository and commit."
887 # Usage: cmd_add_repository REPOSITORY REFSPEC
888 cmd_add_repository
() {
890 echo "git fetch" "$@"
893 git fetch
"$@" ||
exit $?
894 cmd_add_commit FETCH_HEAD
897 # Usage: cmd_add_commit REV
899 # The rev has already been validated by cmd_add(), we just
900 # need to normalize it.
902 rev=$
(git rev-parse
--verify "$1^{commit}") ||
exit $?
904 debug
"Adding $dir as '$rev'..."
905 if test -z "$arg_split_rejoin"
907 # Only bother doing this if this is a genuine 'add',
908 # not a synthetic 'add' from '--rejoin'.
909 git read-tree
--prefix="$dir" $rev ||
exit $?
911 git checkout
-- "$dir" ||
exit $?
912 tree
=$
(git write-tree
) ||
exit $?
914 headrev
=$
(git rev-parse
--verify HEAD
) ||
exit $?
915 if test -n "$headrev" && test "$headrev" != "$rev"
922 if test -n "$arg_addmerge_squash"
924 rev=$
(new_squash_commit
"" "" "$rev") ||
exit $?
925 commit
=$
(add_squashed_msg
"$rev" "$dir" |
926 git commit-tree
$arg_gpg_sign "$tree" $headp -p "$rev") ||
exit $?
928 revp
=$
(peel_committish
"$rev") ||
exit $?
929 commit
=$
(add_msg
"$dir" $headrev "$rev" |
930 git commit-tree
$arg_gpg_sign "$tree" $headp -p "$revp") ||
exit $?
932 git
reset "$commit" ||
exit $?
934 say
>&2 "Added dir '$dir'"
937 # Usage: cmd_split [REV] [REPOSITORY]
941 rev=$
(git rev-parse HEAD
)
942 elif test $# -eq 1 ||
test $# -eq 2
944 rev=$
(git rev-parse
-q --verify "$1^{commit}") ||
945 die
"fatal: '$1' does not refer to a commit"
947 die
"fatal: you must provide exactly one revision, and optionally a repository. Got: '$*'"
955 if test -n "$arg_split_rejoin"
960 debug
"Splitting $dir..."
961 cache_setup ||
exit $?
963 if test -n "$arg_split_onto"
965 debug
"Reading history for --onto=$arg_split_onto..."
966 git rev-list
$arg_split_onto |
969 # the 'onto' history is already just the subdir, so
970 # any parent we find there can be used verbatim
972 cache_set
"$rev" "$rev"
976 unrevs
="$(find_existing_splits "$dir" "$rev" "$repository")" ||
exit $?
978 # We can't restrict rev-list to only $dir here, because some of our
979 # parents have the $dir contents the root, and those won't match.
980 # (and rev-list --follow doesn't seem to solve this)
981 grl
='git rev-list --topo-order --reverse --parents $rev $unrevs'
982 revmax
=$
(eval "$grl" |
wc -l)
987 while read rev parents
989 if should_ignore_subtree_split_commit
"$rev"
994 for parent
in $parents
996 if ! should_ignore_subtree_split_commit
"$parent"
998 parsedparents
="$parsedparents$parent "
1001 process_split_commit
"$rev" "$parsedparents"
1004 latest_new
=$
(cache_get latest_new
) ||
exit $?
1005 if test -z "$latest_new"
1007 die
"fatal: no new revisions were found"
1010 if test -n "$arg_split_rejoin"
1012 debug
"Merging split branch into HEAD..."
1013 latest_old
=$
(cache_get latest_old
) ||
exit $?
1014 arg_addmerge_message
="$(rejoin_msg "$dir" "$latest_old" "$latest_new")" ||
exit $?
1015 if test -z "$(find_latest_squash "$dir")"
1017 cmd_add
"$latest_new" >&2 ||
exit $?
1019 cmd_merge
"$latest_new" >&2 ||
exit $?
1022 if test -n "$arg_split_branch"
1024 if rev_exists
"refs/heads/$arg_split_branch"
1026 if ! git merge-base
--is-ancestor "$arg_split_branch" "$latest_new"
1028 die
"fatal: branch '$arg_split_branch' is not an ancestor of commit '$latest_new'."
1034 git update-ref
-m 'subtree split' \
1035 "refs/heads/$arg_split_branch" "$latest_new" ||
exit $?
1036 say
>&2 "$action branch '$arg_split_branch'"
1042 # Usage: cmd_merge REV [REPOSITORY]
1044 if test $# -lt 1 ||
test $# -gt 2
1046 die
"fatal: you must provide exactly one revision, and optionally a repository. Got: '$*'"
1049 rev=$
(git rev-parse
-q --verify "$1^{commit}") ||
1050 die
"fatal: '$1' does not refer to a commit"
1058 if test -n "$arg_addmerge_squash"
1060 first_split
="$(find_latest_squash "$dir" "$repository")" ||
exit $?
1061 if test -z "$first_split"
1063 die
"fatal: can't squash-merge: '$dir' was never added."
1068 if test "$sub" = "$rev"
1070 say
>&2 "Subtree is already at commit $rev."
1073 new
=$
(new_squash_commit
"$old" "$sub" "$rev") ||
exit $?
1074 debug
"New squash commit: $new"
1078 if test -n "$arg_addmerge_message"
1080 git merge
--no-ff -Xsubtree="$arg_prefix" \
1081 --message="$arg_addmerge_message" $arg_gpg_sign "$rev"
1083 git merge
--no-ff -Xsubtree="$arg_prefix" $arg_gpg_sign $rev
1087 # Usage: cmd_pull REPOSITORY REMOTEREF
1091 die
"fatal: you must provide <repository> <ref>"
1096 ensure_valid_ref_format
"$ref"
1097 git fetch
"$repository" "$ref" ||
exit $?
1098 cmd_merge FETCH_HEAD
"$repository"
1101 # Usage: cmd_push REPOSITORY [+][LOCALREV:]REMOTEREF
1105 die
"fatal: you must provide <repository> <refspec>"
1111 remoteref
=${refspec#*:}
1112 if test "$remoteref" = "$refspec"
1114 localrevname_presplit
=HEAD
1116 localrevname_presplit
=${refspec%%:*}
1118 ensure_valid_ref_format
"$remoteref"
1119 localrev_presplit
=$
(git rev-parse
-q --verify "$localrevname_presplit^{commit}") ||
1120 die
"fatal: '$localrevname_presplit' does not refer to a commit"
1122 echo "git push using: " "$repository" "$refspec"
1123 localrev
=$
(cmd_split
"$localrev_presplit" "$repository") || die
1124 git push
"$repository" "$localrev":"refs/heads/$remoteref"
1126 die
"fatal: '$dir' must already exist. Try 'git subtree add'."