git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/4] subtree: allow --squash and --message with push

From
MOMatthew Ogilvie <mmogilvi_git@miniinfo.net>
Date
Dec 7, 2013, 18:21 UTC
Message-ID
<1386440485-3092-2-git-send-email-mmogilvi_git@miniinfo.net>
In-Reply-To
<1386440485-3092-1-git-send-email-mmogilvi_git@miniinfo.net>
Signed-off-by: Matthew Ogilvie <mmogilvi_git@miniinfo.net>
---
 contrib/subtree/git-subtree.sh  | 8 +++++++-
 contrib/subtree/git-subtree.txt | 9 ---------
 2 files changed, 7 insertions(+), 10 deletions(-)
diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh
index 998a9c5..56d915f 100755
--- a/contrib/subtree/git-subtree.sh
+++ b/contrib/subtree/git-subtree.sh
@@ -743,11 +743,17 @@ cmd_push()
 	if [ $# -ne 2 ]; then
 	    die "You must provide <repository> <refspec>"
 	fi
+
+	opts=
+	if [ -n "$squash" ]; then
+		opts="-squash"
+	fi
+
 	if [ -e "$dir" ]; then
 	    repository=$1
 	    refspec=$2
 	    echo "git push using: " $repository $refspec
-	    localrev=$(git subtree split --prefix="$prefix") || die
+	    localrev=$(git subtree split --prefix="$prefix" $opts --message="$message") || die
 	    git push $repository $localrev:refs/heads/$refspec
 	else
 	    die "'$dir' must already exist. Try 'git subtree add'."
diff --git a/contrib/subtree/git-subtree.txt b/contrib/subtree/git-subtree.txt
index 92e7a4d..03092bc 100644
--- a/contrib/subtree/git-subtree.txt
+++ b/contrib/subtree/git-subtree.txt
@@ -140,20 +140,11 @@ OPTIONS
 	want to manipulate.  This option is mandatory
 	for all commands.
 
-
-OPTIONS FOR add, merge, pull, rejoin
-----------------------------------
 -m <message>::
 --message=<message>::
-	This option is only valid for add, merge, pull, and
-	split '--rejoin'.
-
 	Specify <message> as the commit message for the merge commit.
 
 --squash::
-	This option is only valid for add, merge, pull, and
-	split '--rejoin'.
-
 	Instead of merging the entire history from the subtree
 	project, produce only a single commit that contains all
 	the differences you want to merge, and then merge that
-- 
1.8.3.2
Previous: Matthew OgilvieNext: Matthew Ogilvie
Message 5 of 8 in “subtree: add squash handling for split and push”
  1. subtree: add squash handling for split and pushPierre Penninckx, Nov 23, 2013
  2. Matthew OgilvieNov 28, 2013
  3. Pierre PenninckxNov 28, 2013
  4. 1/4 subtree: support split --rejoin --squashMatthew Ogilvie, Dec 7, 2013
  5. 2/4 subtree: allow --squash and --message with pushMatthew Ogilvie, Dec 7, 2013
  6. 3/4 subtree: add --edit optionMatthew Ogilvie, Dec 7, 2013
  7. 4/4 subtree: poor bugfix for split new commits with parents before previous splitMatthew Ogilvie, Dec 7, 2013
  8. Junio C HamanoDec 10, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.