Permalink
Browse files

Added --force option to push

  • Loading branch information...
jroper committed Mar 27, 2012
1 parent 2793ee6 commit 9027582498a5d5f2ca0c1476282a04c3a65b60fe
Showing with 13 additions and 1 deletion.
  1. +8 −1 git-subtree.sh
  2. +5 −0 git-subtree.txt
View
@@ -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
"
@@ -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= ;;
@@ -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
View
@@ -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
----------------------

0 comments on commit 9027582

Please sign in to comment.