From: "Tom Clarke" <tom@u2i.com>
To: "Johannes Schindelin" <Johannes.Schindelin@gmx.de>
Cc: git@vger.kernel.org
Subject: Re: Add --rebase option to git-pull?
Date: Thu, 30 Aug 2007 17:10:31 +0200 [thread overview]
Message-ID: <550f9510708300810y1ca84e8dt4d0bab8fc99deb3c@mail.gmail.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0708301415150.28586@racer.site>
On 8/30/07, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> In my TODO, there is "add the 'rebase' strategy". It is definitely
> something post-1.5.3, so I do not look into it. But the most logical
> place for me would be to have a strategy 'rebase'. IOW a
> git-merge-rebase.sh.
The following is my first naive attempt, is this the kind of thing you
were thinking of?
In addition to running the rebase, I changed the merge script to
prevent the update-ref as this is (it seems) inappropriate as it
wasn't really a merge we did.
I'm not sure if any of the other arguments (other than remotes) to the
merge script are applicable here.
-Tom
commit b68df7b3c31953216a03b8f34ffbc6d0c0927ea3
Author: Tom Clarke <tom@u2i.com>
Date: Thu Aug 30 17:06:21 2007 +0200
adding rebase merge strategy
diff --git a/.gitignore b/.gitignore
index 63c918c..dd1aa22 100644
--- a/.gitignore
+++ b/.gitignore
@@ -74,6 +74,7 @@ git-merge-tree
git-merge-octopus
git-merge-one-file
git-merge-ours
+git-merge-rebase
git-merge-recursive
git-merge-resolve
git-merge-stupid
diff --git a/Makefile b/Makefile
index 4eb4637..f6adca2 100644
--- a/Makefile
+++ b/Makefile
@@ -210,7 +210,7 @@ SCRIPT_SH = \
git-sh-setup.sh \
git-am.sh \
git-merge.sh git-merge-stupid.sh git-merge-octopus.sh \
- git-merge-resolve.sh git-merge-ours.sh \
+ git-merge-resolve.sh git-merge-ours.sh git-merge-rebase.sh \
git-lost-found.sh git-quiltimport.sh git-submodule.sh \
git-filter-branch.sh \
git-stash.sh
diff --git a/git-merge-rebase.sh b/git-merge-rebase.sh
new file mode 100755
index 0000000..6140d38
--- /dev/null
+++ b/git-merge-rebase.sh
@@ -0,0 +1,32 @@
+#!/bin/sh
+# Resolve two trees with rebase
+
+# The first parameters up to -- are merge bases; the rest are heads.
+bases= head= remotes= sep_seen=
+for arg
+do
+ case ",$sep_seen,$head,$arg," in
+ *,--,)
+ sep_seen=yes
+ ;;
+ ,yes,,*)
+ head=$arg
+ ;;
+ ,yes,*)
+ remotes="$remotes$arg "
+ ;;
+ *)
+ bases="$bases$arg "
+ ;;
+ esac
+done
+
+# Give up if we are given more than two remotes -- not handling octopus.
+case "$remotes" in
+?*' '?*)
+ exit 2 ;;
+esac
+
+git update-index --refresh 2>/dev/null
+
+git rebase $remotes || exit 2
diff --git a/git-merge.sh b/git-merge.sh
index 3a01db0..02611f3 100755
--- a/git-merge.sh
+++ b/git-merge.sh
@@ -16,11 +16,12 @@ test -z "$(git ls-files -u)" ||
LF='
'
-all_strategies='recur recursive octopus resolve stupid ours subtree'
+all_strategies='recur recursive octopus resolve stupid ours subtree rebase'
default_twohead_strategies='recursive'
default_octopus_strategies='octopus'
no_fast_forward_strategies='subtree ours'
no_trivial_strategies='recursive recur subtree ours'
+no_update_ref='rebase'
use_strategies=
allow_fast_forward=t
@@ -81,11 +82,18 @@ finish () {
echo "No merge message -- not updating HEAD"
;;
*)
- git update-ref -m "$rlogm" HEAD "$1" "$head" || exit 1
+ case " $wt_strategy " in
+ *" $no_update_ref "*)
+ ;;
+ *)
+ git update-ref -m "$rlogm" HEAD "$1"
"$head" || exit 1
+ ;;
+ esac
;;
esac
;;
esac
+
case "$1" in
'')
;;
next prev parent reply other threads:[~2007-08-30 15:11 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-30 12:40 Add --rebase option to git-pull? Tom Clarke
2007-08-30 13:07 ` Andreas Ericsson
2007-08-30 13:17 ` Tom Clarke
2007-08-30 13:16 ` Johannes Schindelin
2007-08-30 15:10 ` Tom Clarke [this message]
2007-08-30 15:23 ` Johannes Schindelin
2007-08-30 15:26 ` Tom Clarke
2007-08-30 16:54 ` Jakub Narebski
2007-08-30 20:22 ` Alex Riesen
2007-08-30 20:36 ` Tom Clarke
2007-08-30 20:44 ` Tom Clarke
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=550f9510708300810y1ca84e8dt4d0bab8fc99deb3c@mail.gmail.com \
--to=tom@u2i.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
/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).