<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/git-rebase.sh, branch v2.18.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.18.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.18.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2018-04-26T03:28:43Z</updated>
<entry>
<title>rebase -i: introduce --rebase-merges=[no-]rebase-cousins</title>
<updated>2018-04-26T03:28:43Z</updated>
<author>
<name>Johannes Schindelin</name>
<email>johannes.schindelin@gmx.de</email>
</author>
<published>2018-04-25T12:29:40Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=7543f6f4441a0ec76460a54f90ab8674fe424786'/>
<id>urn:sha1:7543f6f4441a0ec76460a54f90ab8674fe424786</id>
<content type='text'>
When running `git rebase --rebase-merges` non-interactively with an
ancestor of HEAD as &lt;upstream&gt; (or leaving the todo list unmodified),
we would ideally recreate the exact same commits as before the rebase.

However, if there are commits in the commit range &lt;upstream&gt;.. that do not
have &lt;upstream&gt; as direct ancestor (i.e. if `git log &lt;upstream&gt;..` would
show commits that are omitted by `git log --ancestry-path &lt;upstream&gt;..`),
this is currently not the case: we would turn them into commits that have
&lt;upstream&gt; as direct ancestor.

Let's illustrate that with a diagram:

        C
      /   \
A - B - E - F
  \   /
    D

Currently, after running `git rebase -i --rebase-merges B`, the new branch
structure would be (pay particular attention to the commit `D`):

       --- C' --
      /         \
A - B ------ E' - F'
      \    /
        D'

This is not really preserving the branch topology from before! The
reason is that the commit `D` does not have `B` as ancestor, and
therefore it gets rebased onto `B`.

This is unintuitive behavior. Even worse, when recreating branch
structure, most use cases would appear to want cousins *not* to be
rebased onto the new base commit. For example, Git for Windows (the
heaviest user of the Git garden shears, which served as the blueprint
for --rebase-merges) frequently merges branches from `next` early, and
these branches certainly do *not* want to be rebased. In the example
above, the desired outcome would look like this:

       --- C' --
      /         \
A - B ------ E' - F'
  \        /
   -- D' --

Let's introduce the term "cousins" for such commits ("D" in the
example), and let's not rebase them by default. For hypothetical
use cases where cousins *do* need to be rebased, `git rebase
--rebase=merges=rebase-cousins` needs to be used.

Signed-off-by: Johannes Schindelin &lt;johannes.schindelin@gmx.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>rebase: introduce the --rebase-merges option</title>
<updated>2018-04-26T03:28:43Z</updated>
<author>
<name>Johannes Schindelin</name>
<email>johannes.schindelin@gmx.de</email>
</author>
<published>2018-04-25T12:29:04Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=8f6aed71d27f33096449d28c4711d3b68159632e'/>
<id>urn:sha1:8f6aed71d27f33096449d28c4711d3b68159632e</id>
<content type='text'>
Once upon a time, this here developer thought: wouldn't it be nice if,
say, Git for Windows' patches on top of core Git could be represented as
a thicket of branches, and be rebased on top of core Git in order to
maintain a cherry-pick'able set of patch series?

The original attempt to answer this was: git rebase --preserve-merges.

However, that experiment was never intended as an interactive option,
and it only piggy-backed on git rebase --interactive because that
command's implementation looked already very, very familiar: it was
designed by the same person who designed --preserve-merges: yours truly.

Some time later, some other developer (I am looking at you, Andreas!
;-)) decided that it would be a good idea to allow --preserve-merges to
be combined with --interactive (with caveats!) and the Git maintainer
(well, the interim Git maintainer during Junio's absence, that is)
agreed, and that is when the glamor of the --preserve-merges design
started to fall apart rather quickly and unglamorously.

The reason? In --preserve-merges mode, the parents of a merge commit (or
for that matter, of *any* commit) were not stated explicitly, but were
*implied* by the commit name passed to the `pick` command.

This made it impossible, for example, to reorder commits. Not to mention
to move commits between branches or, deity forbid, to split topic branches
into two.

Alas, these shortcomings also prevented that mode (whose original
purpose was to serve Git for Windows' needs, with the additional hope
that it may be useful to others, too) from serving Git for Windows'
needs.

Five years later, when it became really untenable to have one unwieldy,
big hodge-podge patch series of partly related, partly unrelated patches
in Git for Windows that was rebased onto core Git's tags from time to
time (earning the undeserved wrath of the developer of the ill-fated
git-remote-hg series that first obsoleted Git for Windows' competing
approach, only to be abandoned without maintainer later) was really
untenable, the "Git garden shears" were born [*1*/*2*]: a script,
piggy-backing on top of the interactive rebase, that would first
determine the branch topology of the patches to be rebased, create a
pseudo todo list for further editing, transform the result into a real
todo list (making heavy use of the `exec` command to "implement" the
missing todo list commands) and finally recreate the patch series on
top of the new base commit.

That was in 2013. And it took about three weeks to come up with the
design and implement it as an out-of-tree script. Needless to say, the
implementation needed quite a few years to stabilize, all the while the
design itself proved itself sound.

With this patch, the goodness of the Git garden shears comes to `git
rebase -i` itself. Passing the `--rebase-merges` option will generate
a todo list that can be understood readily, and where it is obvious
how to reorder commits. New branches can be introduced by inserting
`label` commands and calling `merge &lt;label&gt;`. And once this mode will
have become stable and universally accepted, we can deprecate the design
mistake that was `--preserve-merges`.

Link *1*:
https://github.com/msysgit/msysgit/blob/master/share/msysGit/shears.sh
Link *2*:
https://github.com/git-for-windows/build-extra/blob/master/shears.sh

Signed-off-by: Johannes Schindelin &lt;johannes.schindelin@gmx.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'pw/rebase-signoff'</title>
<updated>2018-04-25T04:28:51Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2018-04-25T04:28:51Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=850e9257525ef2fa13e1d34ccce4e6b73085bb4e'/>
<id>urn:sha1:850e9257525ef2fa13e1d34ccce4e6b73085bb4e</id>
<content type='text'>
"git rebase" has learned to honor "--signoff" option when using
backends other than "am" (but not "--preserve-merges").

* pw/rebase-signoff:
  rebase --keep-empty: always use interactive rebase
  rebase -p: error out if --signoff is given
  rebase: extend --signoff support
</content>
</entry>
<entry>
<title>Merge branch 'pw/rebase-keep-empty-fixes'</title>
<updated>2018-04-25T04:28:49Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2018-04-25T04:28:49Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=d892beef52a293b271538481dbc76014672ddf09'/>
<id>urn:sha1:d892beef52a293b271538481dbc76014672ddf09</id>
<content type='text'>
"git rebase --keep-empty" still removed an empty commit if the
other side contained an empty commit (due to the "does an
equivalent patch exist already?" check), which has been corrected.

* pw/rebase-keep-empty-fixes:
  rebase: respect --no-keep-empty
  rebase -i --keep-empty: don't prune empty commits
  rebase --root: stop assuming squash_onto is unset
</content>
</entry>
<entry>
<title>rebase --keep-empty: always use interactive rebase</title>
<updated>2018-03-29T18:09:03Z</updated>
<author>
<name>Phillip Wood</name>
<email>phillip.wood@dunelm.org.uk</email>
</author>
<published>2018-03-20T11:10:57Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=da27a6fbd50861149b32cfd1f9e5c36a935c575a'/>
<id>urn:sha1:da27a6fbd50861149b32cfd1f9e5c36a935c575a</id>
<content type='text'>
rebase --merge accepts --keep-empty but just ignores it, by using an
implicit interactive rebase the user still gets the rename detection
of a merge based rebase but with with --keep-empty support.

If rebase --keep-empty without --interactive or --merge stops for the
user to resolve merge conflicts then 'git rebase --continue' will
fail. This is because it uses a different code path that does not
create $git_dir/rebase-apply. As rebase --keep-empty was implemented
using cherry-pick it has never supported the am options and now that
interactive rebases support --signoff there is no loss of
functionality by using an implicit interactive rebase.

Signed-off-by: Phillip Wood &lt;phillip.wood@dunelm.org.uk&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>rebase -p: error out if --signoff is given</title>
<updated>2018-03-29T18:09:03Z</updated>
<author>
<name>Phillip Wood</name>
<email>phillip.wood@dunelm.org.uk</email>
</author>
<published>2018-03-20T11:10:56Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=b79966aa386fc58801e93496cd4e97d82acd53a5'/>
<id>urn:sha1:b79966aa386fc58801e93496cd4e97d82acd53a5</id>
<content type='text'>
rebase --preserve-merges does not support --signoff so error out
rather than just silently ignoring it so that the user knows the
commits will not be signed off.

Signed-off-by: Phillip Wood &lt;phillip.wood@dunelm.org.uk&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>rebase: extend --signoff support</title>
<updated>2018-03-29T18:09:03Z</updated>
<author>
<name>Phillip Wood</name>
<email>phillip.wood@dunelm.org.uk</email>
</author>
<published>2018-03-20T11:10:55Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a852ec7f273cf61296a80ddfc26c23acf2163f2f'/>
<id>urn:sha1:a852ec7f273cf61296a80ddfc26c23acf2163f2f</id>
<content type='text'>
Allow --signoff to be used with --interactive and --merge. In
interactive mode only commits marked to be picked, edited or reworded
will be signed off.

The main motivation for this patch was to allow one to run 'git rebase
--exec "make check" --signoff' which is useful when preparing a patch
series for publication and is more convenient than doing the signoff
with another --exec command.

This change also allows --root without --onto to work with --signoff
as well (--root with --onto was already supported).

Signed-off-by: Phillip Wood &lt;phillip.wood@dunelm.org.uk&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>rebase: respect --no-keep-empty</title>
<updated>2018-03-29T17:46:48Z</updated>
<author>
<name>Phillip Wood</name>
<email>phillip.wood@dunelm.org.uk</email>
</author>
<published>2018-03-20T10:03:15Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=3d946165e1177905103a25aeb374e018c510e540'/>
<id>urn:sha1:3d946165e1177905103a25aeb374e018c510e540</id>
<content type='text'>
$OPT_SPEC has always allowed --no-keep-empty so lets start handling
it.

Signed-off-by: Phillip Wood &lt;phillip.wood@dunelm.org.uk&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>rebase: add and use git_rebase__interactive__preserve_merges</title>
<updated>2018-03-23T22:28:06Z</updated>
<author>
<name>Wink Saville</name>
<email>wink@saville.com</email>
</author>
<published>2018-03-23T21:25:26Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=950b487cf06672c60ab5080bf5b6a59bd394457d'/>
<id>urn:sha1:950b487cf06672c60ab5080bf5b6a59bd394457d</id>
<content type='text'>
At the moment it's an exact copy of git_rebase__interactive except
the name has changed.

Signed-off-by: Wink Saville &lt;wink@saville.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>rebase: update invocation of rebase dot-sourced scripts</title>
<updated>2018-03-23T22:08:49Z</updated>
<author>
<name>Wink Saville</name>
<email>wink@saville.com</email>
</author>
<published>2018-03-23T21:25:23Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=2f5f469bc428eb029133ce4343c41fdf1c58c8a5'/>
<id>urn:sha1:2f5f469bc428eb029133ce4343c41fdf1c58c8a5</id>
<content type='text'>
Due to historical reasons, the backend scriptlets for "git rebase"
are structured a bit unusually. As originally designed,
dot-sourcing them from "git rebase" was sufficient to invoke the
specific backend.

However, it was later discovered that some shell implementations
(e.g. FreeBSD 9.x) misbehaved by continuing to execute statements
following a top-level "return" rather than returning control to
the next statement in "git rebase" after dot-sourcing the
scriptlet. To work around this shortcoming, the whole body of
git-rebase--$backend.sh was made into a shell function
git_rebase__$backend, and then the very last line of the scriptlet
called that function.

A more normal architecture is for a dot-sourced scriptlet merely
to define functions (thus acting as a function library), and for
those functions to be called by the script doing the dot-sourcing.
Migrate to this arrangement by moving the git_rebase__$backend
call from the end of a scriptlet into "git rebase" itself.

While at it, remove the large comment block from each scriptlet
explaining this historic anomaly since it serves no purpose under
the new normalized architecture in which a scriptlet is merely a
function library.

Signed-off-by: Wink Saville &lt;wink@saville.com&gt;
Helped-by: Junio C Hamano &lt;gitster@pobox.com&gt;
Helped-by: Eric Sunshine &lt;sunshine@sunshineco.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
