Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion git-subtree.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ b,branch= create a new branch from the split subtree
ignore-joins ignore prior --rejoin commits
onto= try connecting new tree to an existing one
rejoin merge the new branch back into HEAD
options for 'push'
f,force use force push
options for 'add', 'merge', 'pull' and 'push'
squash merge subtree changes as a single commit
"
Expand Down Expand Up @@ -83,6 +85,7 @@ while [ $# -gt 0 ]; do
-b) branch="$1"; shift ;;
-P) prefix="$1"; shift ;;
-m) message="$1"; shift ;;
-f|--force) force=1 ;;
--no-prefix) prefix= ;;
--onto) onto="$1"; shift ;;
--no-onto) onto= ;;
Expand Down Expand Up @@ -700,10 +703,14 @@ cmd_push()
die "You must provide <repository> <refspec>"
fi
if [ -e "$dir" ]; then
push_opts=
if [ "$force" == "1" ]; then
push_opts="$push_opts --force"
fi
repository=$1
refspec=$2
echo "git push using: " $repository $refspec
git push $repository $(git subtree split --prefix=$prefix):refs/heads/$refspec
git push $push_opts $repository $(git subtree split --prefix=$prefix):refs/heads/$refspec
else
die "'$dir' must already exist. Try 'git subtree add'."
fi
Expand Down
5 changes: 5 additions & 0 deletions git-subtree.txt
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,11 @@ OPTIONS FOR split
'--rejoin' when you split, because you don't want the
subproject's history to be part of your project anyway.

OPTIONS FOR push
----------------
-f::
--force::
Uses 'git push --force'.

EXAMPLE 1. Add command
----------------------
Expand Down