From 9027582498a5d5f2ca0c1476282a04c3a65b60fe Mon Sep 17 00:00:00 2001 From: James Roper Date: Tue, 27 Mar 2012 15:32:57 +0200 Subject: [PATCH] Added --force option to push --- git-subtree.sh | 9 ++++++++- git-subtree.txt | 5 +++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/git-subtree.sh b/git-subtree.sh index 920c664..611967f 100755 --- a/git-subtree.sh +++ b/git-subtree.sh @@ -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 " 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 diff --git a/git-subtree.txt b/git-subtree.txt index 0c44fda..a150306 100644 --- a/git-subtree.txt +++ b/git-subtree.txt @@ -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 ----------------------