File tree 2 files changed +17
-1
lines changed
2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,8 @@ b,branch= create a new branch from the split subtree
31
31
ignore-joins ignore prior --rejoin commits
32
32
onto= try connecting new tree to an existing one
33
33
rejoin merge the new branch back into HEAD
34
+ options for 'push'
35
+ f,force use force push
34
36
options for 'add', 'merge', 'pull' and 'push'
35
37
squash merge subtree changes as a single commit
36
38
"
@@ -89,6 +91,7 @@ while [ $# -gt 0 ]; do
89
91
-b) branch=" $1 " ; shift ;;
90
92
-P|--prefix) prefix=" $1 " ; shift ;;
91
93
-m) message=" $1 " ; shift ;;
94
+ -f|--force) force=1 ;;
92
95
--no-prefix) prefix= ;;
93
96
--onto) onto=" $1 " ; shift ;;
94
97
--no-onto) onto= ;;
@@ -781,10 +784,16 @@ cmd_push()
781
784
repository=$( git config -f .gittrees subtree.$prefix .url)
782
785
refspec=$( git config -f .gittrees subtree.$prefix .branch)
783
786
fi
787
+
788
+ push_opts=
789
+ if [ " $force " == " 1" ]; then
790
+ push_opts=" $push_opts --force"
791
+ fi
792
+
784
793
echo " git push using: " $repository $refspec
785
794
rev=$( git subtree split --prefix=$prefix )
786
795
if [ -n " $rev " ]; then
787
- git push $repository $rev :refs/heads/$refspec
796
+ git push $push_opts $ repository $rev :refs/heads/$refspec
788
797
else
789
798
die " Couldn't push, 'git subtree split' failed."
790
799
fi
Original file line number Diff line number Diff line change @@ -278,6 +278,13 @@ OPTIONS FOR split
278
278
'--rejoin' when you split, because you don't want the
279
279
subproject's history to be part of your project anyway.
280
280
281
+ OPTIONS FOR push
282
+ ----------------
283
+ -f::
284
+ --force::
285
+ Uses 'git push --force'.
286
+
287
+
281
288
282
289
EXAMPLE 1. Add command
283
290
----------------------
You can’t perform that action at this time.
0 commit comments