From: Greg Price <greg@quora.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: [PATCH 0/6] rebase: command "ref" and options --rewrite-{refs,heads,tags}
Date: Sun, 26 Jun 2011 17:16:57 -0700 [thread overview]
Message-ID: <cover.1309133817.git.greg@quora.com> (raw)
This series adds a "ref" command to rebase -i, and options
--rewrite-{refs,heads,tags} to generate "ref" commands in the original
TODO file. This makes it easy to rebase a branch together with
intermediate markers, or a series of branches.
For example, in this situation:
part1 part2 topic
| | |
v v v
A--*--*--*--*--*--*
\
B <--master
we may want to rebase 'topic' onto the new master, rewriting the
intermediate branches 'part1', 'part2' to the corresponding new
commits. This can be done with a sequence of "git rebase --onto"
commands, but it's tricky to get right.
With this series, the command
$ git rebase --rewrite-heads master topic
suffices to produce this result:
part1 part2 topic
A | | |
\ v v v
B--*--*--*--*--*--*
^
|
master
I originally submitted a version of this series nearly a year and a
half ago [1]. This version has been rebased to the new release 1.7.6
(Martin von Zweigbergk's cleanups gave me quite some conflicts to
resolve, but are nevertheless much appreciated!) and the interface has
been adjusted for the comments of Junio and others [2]. The general
command is --rewrite-refs=PATTERN; --rewrite-heads and --rewrite-tags
are provided as shortcuts, the former being equivalent to the --refs
of my original proposal.
[1] http://www.amailbox.net/mailarchive/git/2009/12/22/18967
[2] http://www.amailbox.net/mailarchive/git/2009/12/22/18972
I have no excuse for the year and a half of delay in submitting the
revised version, but I believe that late is better than never. =)
The series contains two preparatory patches that are independently useful:
pretty: Add %D for script-friendly decoration
for-each-ref: --stdin to match specified refs against pattern
Each one exposes a bit more knowledge of the repository in a
machine-readable form convenient for scripting. I hope other people
may find them useful in writing other scripts.
Greg
---
Greg Price (6):
rebase -i: Add the "ref" command
pretty: Add %D for script-friendly decoration
for-each-ref: --stdin to match specified refs against pattern
rebase: --rewrite-{refs,heads,tags} to pull refs along with branch
t/lib-rebase.sh: pass through ref commands
rebase --rewrite-refs: tests
Documentation/git-rebase.txt | 15 ++++++++
Documentation/pretty-formats.txt | 1 +
builtin/for-each-ref.c | 22 ++++++++++-
git-rebase--interactive.sh | 37 ++++++++++++++++++-
git-rebase.sh | 28 ++++++++++++++
pretty.c | 33 +++++++++++++----
t/lib-rebase.sh | 2 +-
t/t3420-rebase-ref.sh | 75 ++++++++++++++++++++++++++++++++++++++
8 files changed, 201 insertions(+), 12 deletions(-)
create mode 100644 t/t3420-rebase-ref.sh
--
1.7.5.4
next reply other threads:[~2011-06-27 0:42 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-27 0:16 Greg Price [this message]
2009-10-10 2:52 ` [PATCH 1/6] rebase -i: Add the "ref" command Greg Price
2011-06-27 18:46 ` Junio C Hamano
2011-06-28 11:15 ` Greg Price
2009-11-18 23:22 ` [PATCH 2/6] pretty: Add %D for script-friendly decoration Greg Price
2011-06-27 19:07 ` Junio C Hamano
2009-11-18 23:51 ` [PATCH 4/6] rebase: --rewrite-{refs,heads,tags} to pull refs along with branch Greg Price
2011-06-27 16:11 ` Phil Hord
2011-06-28 11:19 ` Greg Price
2010-01-07 23:08 ` [PATCH 3/6] for-each-ref: --stdin to match specified refs against pattern Greg Price
2010-01-25 2:26 ` [PATCH 5/6] t/lib-rebase.sh: pass through ref commands Greg Price
2010-01-25 2:28 ` [PATCH 6/6] rebase --rewrite-refs: tests Greg Price
2011-06-27 16:07 ` Phil Hord
2011-06-28 11:22 ` Greg Price
2011-06-27 21:02 ` Junio C Hamano
2011-06-28 11:20 ` Greg Price
2011-06-27 18:36 ` [PATCH 0/6] rebase: command "ref" and options --rewrite-{refs,heads,tags} Junio C Hamano
[not found] ` <BANLkTinDFYsw7-N=_Ex8i42So_0LzVAWvA@mail.gmail.com>
2011-06-28 10:47 ` Fwd: " Greg Price
2011-06-28 13:17 ` Greg Price
2011-06-30 4:25 ` Ramkumar Ramachandra
2011-08-03 13:32 ` Fwd: " Sverre Rabbelier
2011-08-03 22:31 ` Greg Price
2011-06-27 21:23 ` Junio C Hamano
[not found] ` <BANLkTi=Akib+7R7D2GEwV8dOTQ1vsqgfxA@mail.gmail.com>
2011-06-28 10:56 ` Fwd: " Greg Price
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=cover.1309133817.git.greg@quora.com \
--to=greg@quora.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.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).