Re: [PATCH 1/3] rebase: teach rebase --keep-base
- From
Denton Liu <liu.denton@gmail.com>
- Date
- Mar 25, 2019, 05:41 UTC
- Message-ID
- <20190325054145.GA1652@archbookpro.localdomain>
- In-Reply-To
- <20190325000618.GB9384@archbookpro.localdomain>
On Sun, Mar 24, 2019 at 05:06:18PM -0700, Denton Liu wrote:
Show 49 quoted lines
> Hi Junio,
>
> On Sun, Mar 24, 2019 at 10:20:28PM +0900, Junio C Hamano wrote:
> > Denton Liu <liu.denton@gmail.com> writes:
> >
> > > A common scenario is if a user is working on a topic branch and they
> > > wish to make some changes to intermediate commits or autosquashing, they
> > > would run something such as
> > >
> > > git rebase -i --onto master... master
> > >
> > > in order to preserve the merge base. This prevents unnecessary commit
> > > churning.
> > >
> > > Alternatively, a user wishing to test individual commits in a topic
> > > branch without changing anything may run
> > >
> > > git rebase -x ./test.sh master... master
> > >
> > > Since rebasing onto the merge base of the branch and the upstream is
> > > such a common case, introduce the --keep-base option as a shortcut.
> > >
> > > This allows us to rewrite the above as
> > >
> > > git rebase -i --keep-base master
> > >
> > > and
> > >
> > > git rebase -x ./test.sh --keep-base master
> > >
> > > respectively.
> >
> > I never use the "feature" myself, but I recall that when "git
> > rebase" is run on a branch appropriately prepared, you do not even
> > have to say <upstream> (iow, you type "git rebase<RET>" and rebase
> > on top of @{upstream}).
> >
> > Can this new "--keep-base" feature mesh well with it? When the
> > current branch has forked from origin/master, for example, it would
> > be good if
> >
> > $ git rebase -i --same-base
> >
> > becomes a usable short-hand for
> >
> > $ git rebase -i --same-base origin/master
>
> By "--same-base", I am assuming you mistyped and meant to write
> "--keep-base"? If that's the case, I can make it a shorthand.Sorry, I misunderstood your question. "--keep-base" already has the shorthand case handled by default.
One caveat is that "--fork-point" is automatically implied if no upstream is supplied but this behaviour is the same for "--onto" or when no other options are supplied as well.
I don't use the feature either so I'm not really sure if this behaviour would be the most sane thing to do.
Show 9 quoted lines
> Thanks, > > Denton > > > > > aka > > > > $ git rebase -i --onto $(git merge-base HEAD origin/master) origin/master > >