Browse files

Added --force option to push

manually merged for whitespace reasons.
  • Loading branch information...
1 parent 00b1b9f commit b9a745f7741176ce25a2549bc13a9ff3566ad50a @jroper jroper committed with Mar 27, 2012
Showing with 17 additions and 1 deletion.
  1. +10 −1 git-subtree.sh
  2. +7 −0 git-subtree.txt
View
11 git-subtree.sh
@@ -31,6 +31,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
"
@@ -89,6 +91,7 @@ while [ $# -gt 0 ]; do
-b) branch="$1"; shift ;;
-P|--prefix) prefix="$1"; shift ;;
-m) message="$1"; shift ;;
+ -f|--force) force=1 ;;
--no-prefix) prefix= ;;
--onto) onto="$1"; shift ;;
--no-onto) onto= ;;
@@ -781,10 +784,16 @@ cmd_push()
repository=$(git config -f .gittrees subtree.$prefix.url)
refspec=$(git config -f .gittrees subtree.$prefix.branch)
fi
+
+ push_opts=
+ if [ "$force" == "1" ]; then
+ push_opts="$push_opts --force"
+ fi
+
echo "git push using: " $repository $refspec
rev=$(git subtree split --prefix=$prefix)
if [ -n "$rev" ]; then
- git push $repository $rev:refs/heads/$refspec
+ git push $push_opts $repository $rev:refs/heads/$refspec
else
die "Couldn't push, 'git subtree split' failed."
fi
View
7 git-subtree.txt
@@ -278,6 +278,13 @@ 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
----------------------

0 comments on commit b9a745f

Please sign in to comment.