Re: Pick the right default and stop warn on `git pull`
- From
Felipe Contreras <felipe.contreras@gmail.com>
- Date
- Nov 24, 2020, 22:11 UTC
- Message-ID
- <CAMP44s2z3vv2LwoMesydVL3qWrJh0VvHSUy+FpnqguoipRRD9g@mail.gmail.com>
- In-Reply-To
- <CAMMLpeSoGtqeCm6u-zrHqvPhW7brvNk_kwde3uqmbPcP1JgMHg@mail.gmail.com>
On Tue, Nov 24, 2020 at 2:22 PM Alex Henrie <alexhenrie24@gmail.com> wrote:
Show 16 quoted lines
> > On Mon, Nov 23, 2020 at 8:41 PM Felipe Contreras > <felipe.contreras@gmail.com> wrote: > > > > 1. git pull # fail by default unless it's a fast-forward > > 2. git pull --merge # force a merge (unless it's a fast-forward, > > depending on pull.ff) > > 3. git pull --rebase # force a rebase (unless it's a fast-forward, > > depending on pull.ff) > > I'm not sure that we need a new --merge flag for this. It sounds like > we just want pull.ff to default to "only" if pull.rebase is not set, > and if pull.rebase is set (or --rebase or --no-rebase is passed on the > command line) then pull.ff should default to "true". If I understand > correctly, that would get us everything we want without adding any new > variables or making any major changes to how Git works.
Before making "pull.ff=only" the default, we need a transitional period in which if it's unset, a warning is printed when pulling a non-fast-forward branch. This is what my patch did several years ago.
And yes, it should be possible to do what you suggest, but have you tried? I suspect both the code and the documentation would be quite convoluted.
Cheers.
-- Felipe Contreras