From: "Tom Clarke" <tom@u2i.com>
To: git@vger.kernel.org
Subject: Add --rebase option to git-pull?
Date: Thu, 30 Aug 2007 14:40:54 +0200 [thread overview]
Message-ID: <550f9510708300540u13c77201oe7cbe599c6773364@mail.gmail.com> (raw)
Hi,
I'm in the process of setting up a git environment with a number of
shared branches. To avoid putting unnecessary merges into the trunk,
we'd like to normally use rebase when updating private branches. I
wondered if it would be possible to automatically determine the
correct remote branch to rebase against.
The most logical place to do this seemed to be in git-pull, so I
experimented with adding a '--rebase' option, per the (rough) diff
below.
I'm quite new to git, so is this a good strategy?
-Tom
commit 60b7318c2ebb7ee2bd1afb02f1fc925a29e1b214
Author: Tom Clarke <tom@u2i.com>
Date: Thu Aug 30 14:39:34 2007 +0200
Added --rebase option to pull
diff --git a/git-pull.sh b/git-pull.sh
index 5e96d1f..233a1d9 100755
--- a/git-pull.sh
+++ b/git-pull.sh
@@ -15,7 +15,7 @@ cd_to_toplevel
test -z "$(git ls-files -u)" ||
die "You are in the middle of a conflicted merge."
-strategy_args= no_summary= no_commit= squash=
+strategy_args= no_summary= no_commit= squash= rebase=false
while case "$#,$1" in 0) break ;; *,-*) ;; *) break ;; esac
do
case "$1" in
@@ -29,6 +29,8 @@ do
no_commit=--no-commit ;;
--sq|--squ|--squa|--squas|--squash)
squash=--squash ;;
+ --re|--reb|--reba|--rebase)
+ rebase=true ;;
-s=*|--s=*|--st=*|--str=*|--stra=*|--strat=*|--strate=*|\
--strateg=*|--strategy=*|\
-s|--s|--st|--str|--stra|--strat|--strate|--strateg|--strategy)
@@ -119,5 +121,10 @@ then
fi
merge_name=$(git fmt-merge-msg <"$GIT_DIR/FETCH_HEAD") || exit
-exec git-merge $no_summary $no_commit $squash $strategy_args \
+if test $rebase != "false"
+then
+ exec git-rebase $strategy_args $merge_head
+else
+ exec git-merge $no_summary $no_commit $squash $strategy_args \
"$merge_name" HEAD $merge_head
+fi
next reply other threads:[~2007-08-30 12:41 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-30 12:40 Tom Clarke [this message]
2007-08-30 13:07 ` Add --rebase option to git-pull? Andreas Ericsson
2007-08-30 13:17 ` Tom Clarke
2007-08-30 13:16 ` Johannes Schindelin
2007-08-30 15:10 ` Tom Clarke
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=550f9510708300540u13c77201oe7cbe599c6773364@mail.gmail.com \
--to=tom@u2i.com \
--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).