Hello, On Tue, Feb 28, 2023 at 12:14:41PM -0700, Jonathan Corbet wrote: > Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx> writes: > > > From: Uwe Kleine-König <uwe@xxxxxxxxxxxxxxxxx> > > > > The "^0" doesn't have the described effect to only do fast-forward merges. > > For example > > > > git checkout 055efab3120b > > git merge v5.2-rc1^0 > > > > creates a normal merge commit. In fact "v5.2-rc1^0" only refers to the > > commit the tag v5.2-rc1 points to. > > So that pattern came straight from Linus, and it still works fine for me > - just tried it and got the expected fast-forward. Yes, git merge v5.2-rc1^0 creates a ff when done on a branch that is fully merged into v5.2-rc1. But then so does git merge v5.2-rc1 , the "^0" has no influence there. In the example from my commit log (that doesn't result in a ff) the only difference is the generated commit log for the non-ff merge. At least for me I get Merge commit 'v5.2-rc1^0' into HEAD with the ^0, and if I drop the ^0 I get: Merge tag 'v5.2-rc1' into HEAD Linux 5.2-rc1 and a valid signature. (So I'd say the variant without ^0 is better.) > Maybe you have something in your git configuration that makes things > behave differently? I think the behaviour for me is the same as for you. "git merge v5.2-rc1^0" isn't wrong per se, it does the right thing in the described situation. But that's not because of the ^0. > > Fixes: d95ea1a4e1fb ("docs: Add a document on repository management") > > Signed-off-by: Uwe Kleine-König <uwe@xxxxxxxxxxxxxxxxx> > > --- > > Documentation/maintainer/rebasing-and-merging.rst | 6 +----- > > 1 file changed, 1 insertion(+), 5 deletions(-) > > > > diff --git a/Documentation/maintainer/rebasing-and-merging.rst b/Documentation/maintainer/rebasing-and-merging.rst > > index 09f988e7fa71..85800ce95ae5 100644 > > --- a/Documentation/maintainer/rebasing-and-merging.rst > > +++ b/Documentation/maintainer/rebasing-and-merging.rst > > @@ -213,11 +213,7 @@ point rather than some random spot. If your upstream-bound branch has > > emptied entirely into the mainline during the merge window, you can pull it > > forward with a command like:: > > > > - git merge v5.2-rc1^0 > > - > > -The "^0" will cause Git to do a fast-forward merge (which should be > > -possible in this situation), thus avoiding the addition of a spurious merge > > -commit. > > + git merge --ff-only v5.2-rc1 > > > > Git was fixed a couple of years or so ago to do the fast-forward by > default when it can, so the original advice in this file is unnecessary > - as is --ff-only (most of the time). So the patch is worth applying, > but I may tweak the changelog some. I think mentioning --ff-only is good, because then git merge does the right thing independant of the configuration. And it errors out if a ff merge is not possible. Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | https://www.pengutronix.de/ |
Attachment:
signature.asc
Description: PGP signature