From: Mike Lewis <mike@mplew.is>
To: git@vger.kernel.org
Cc: "David A . Greene" <greened@obbligato.org>,
Techlive Zheng <techlivezheng@gmail.com>,
James Denholm <nod.helm@gmail.com>,
David Aguilar <davvid@gmail.com>,
Charles Bailey <cbailey32@bloomberg.net>,
Mike Lewis <mike@mplew.is>
Subject: [PATCH] contrib/subtree: add "--no-commit" flag for merge and pull
Date: Sun, 26 Mar 2017 03:02:38 -0400 [thread overview]
Message-ID: <20170326070238.64522-1-mike@mplew.is> (raw)
Allows the user to verify and/or change the contents of the merge
before committing as necessary
Signed-off-by: Mike Lewis <mike@mplew.is>
---
contrib/subtree/git-subtree.sh | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh
index dec085a23..c30087485 100755
--- a/contrib/subtree/git-subtree.sh
+++ b/contrib/subtree/git-subtree.sh
@@ -29,6 +29,8 @@ onto= try connecting new tree to an existing one
rejoin merge the new branch back into HEAD
options for 'add', 'merge', and 'pull'
squash merge subtree changes as a single commit
+ options for 'merge' and 'pull'
+no-commit perform the merge, but don't commit
"
eval "$(echo "$OPTS_SPEC" | git rev-parse --parseopt -- "$@" || echo exit $?)"
@@ -48,6 +50,7 @@ annotate=
squash=
message=
prefix=
+commit_option="--commit"
debug () {
if test -n "$debug"
@@ -137,6 +140,12 @@ do
--no-squash)
squash=
;;
+ --no-commit)
+ commit_option="--no-commit"
+ ;;
+ --no-no-commit)
+ commit_option="--commit"
+ ;;
--)
break
;;
@@ -815,17 +824,17 @@ cmd_merge () {
then
if test -n "$message"
then
- git merge -s subtree --message="$message" "$rev"
+ git merge -s subtree --message="$message" "$commit_option" "$rev"
else
- git merge -s subtree "$rev"
+ git merge -s subtree "$commit_option" "$rev"
fi
else
if test -n "$message"
then
git merge -Xsubtree="$prefix" \
- --message="$message" "$rev"
+ --message="$message" "$commit_option" "$rev"
else
- git merge -Xsubtree="$prefix" $rev
+ git merge -Xsubtree="$prefix" "$commit_option" $rev
fi
fi
}
--
2.12.2
next reply other threads:[~2017-03-26 7:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-26 7:02 Mike Lewis [this message]
2017-03-29 7:37 ` [PATCH] contrib/subtree: add "--no-commit" flag for merge and pull David Aguilar
2017-03-29 7:56 ` Mike Lewis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170326070238.64522-1-mike@mplew.is \
--to=mike@mplew.is \
--cc=cbailey32@bloomberg.net \
--cc=davvid@gmail.com \
--cc=git@vger.kernel.org \
--cc=greened@obbligato.org \
--cc=nod.helm@gmail.com \
--cc=techlivezheng@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).