Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added --force option for doing a git push --force #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 8 additions & 1 deletion git-subtree.sh
Expand Up @@ -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
"
Expand Down Expand Up @@ -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= ;;
Expand Down Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions git-subtree.txt
Expand Up @@ -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
----------------------
Expand Down