Re: Weird merge records

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dan Stromberg wrote:
> On Mon, May 8, 2023 at 8:03 AM Felipe Contreras
> <felipe.contreras@xxxxxxxxx> wrote:
> > > 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 consider myself a git neophyte.  It's a large topic.
> 
> > 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.
> 
> I see.
> 
> > > 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.
> 
> Might that look like:
>         git checkout "$branch"
>         git fetch upstream
>         git rebase "$branch"

With `git rebase` you specify the upstream branch you want to rebase to, so:

  git rebase upstream/master

This can be configured with the "upstream tracking branch" info, so:

  git rebase "$branch"@{upstream}

But this is the default of `git rebase`, so just:

  git rebase

>         git push origin "$branch"

If the branch already exists in the remote, you are probably going to need --force there.

Also, you don't need to checkout the branch, as `git rebase` can do that for you.

This is what I would do:

  git fetch upstream
  git rebase upstream/master $branch
  git push --force origin $branch

Hopefully in this scenario "upstream" is the upstream repository and "origin"
is your personal fork.

-- 
Felipe Contreras



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux