Re: Weird merge records
- From
Felipe Contreras <felipe.contreras@gmail.com>
- Date
- May 8, 2023, 15:03 UTC
- Message-ID
- <64590f5430b36_79d229439@chronos.notmuch>
- In-Reply-To
- <CAOvKW55MbXF8sDaGTTk9XJxw6Ln9E9G8qOF4wbXzEKY=GH=Zag@mail.gmail.com>
Dan Stromberg wrote:
Show 20 quoted lines
> On Sun, May 7, 2023 at 1:34 PM Felipe Contreras > <felipe.contreras@gmail.com> wrote: > > > > On Sat, May 6, 2023 at 10:20 AM Thomas Guyot <tguyot@gmail.com> wrote: > > > > > You shouldn't change the user's config - you can instead use > > > command-line switches with git-pull to force the desired behavior. In > > > this case (which is also the default if there is no pull.rebase config) > > > it will merge with the remote (and that merge will be a fast-forward if > > > you have no added commits). > > > > Actually no: it won't merge the current branch with the remote, it > > will merge the remote with the current branch, which is not the same. > > > > This is one of the many reasons many git veterans recommend most users > > to simply avoid doing `git pull` [1]: it very rarely does what you > > want. > > You seem to be implying that I shouldn't use 'git pull --rebase > upstream "$branch"'.
If you know what you are doing, then do whatever you want. `git pull --rebase upstream $branch` is fine, if you know what that does.
I would just keep in mind that `git pull` wasn't meant to merge your changes to upstream, it was meant to merge $branch to your integration branch.
> If that's the case, what would you recommend?
I would recommend `git fetch` + `git rebase` (or merge). If you are explicit about what you want to do, surprises are minimized.
-- Felipe Contreras