[PATCH 18/19] Added --force option to push
From: Paul Campbell <hidden>
Date: 2016-06-15 22:56:20
Subsystem:
the rest · Maintainer:
Linus Torvalds
From ae7c05bdc6d02fa89deabb59cec6150308f227f7 Mon Sep 17 00:00:00 2001
From: Paul Campbell <redacted> Date: Sat, 9 Mar 2013 18:35:42 +0000 Subject: [PATCH 18/19] Added --force option to push Conflicts: contrib/subtree/git-subtree.sh Original-Author: James Roper [off-list ref] Conflicts-resolved-by: Paul Campbell [off-list ref] --- contrib/subtree/git-subtree.sh | 9 ++++++++- contrib/subtree/git-subtree.txt | 5 +++++ 2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh
index 4605203..3582a55 100755
--- a/contrib/subtree/git-subtree.sh
+++ b/contrib/subtree/git-subtree.sh@@ -32,6 +32,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 "
@@ -90,6 +92,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= ;;
@@ -790,10 +793,14 @@ 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
diff --git a/contrib/subtree/git-subtree.txt b/contrib/subtree/git-subtree.txt
index 385bde8..9e9eb9e 100644
--- a/contrib/subtree/git-subtree.txt
+++ b/contrib/subtree/git-subtree.txt@@ -278,6 +278,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 ----------------------
--
1.8.2.rc1
--
Paul [W] Campbell