git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Felipe Contreras <felipe.contreras@gmail.com>
To: Dan Stromberg <strombrg@gmail.com>,
	Felipe Contreras <felipe.contreras@gmail.com>
Cc: Thomas Guyot <tguyot@gmail.com>, git@vger.kernel.org
Subject: Re: Weird merge records
Date: Mon, 08 May 2023 11:17:02 -0600	[thread overview]
Message-ID: <64592e8e848f2_8a9f294a3@chronos.notmuch> (raw)
In-Reply-To: <CAOvKW57WdwNoYXJyebMf-V4mQBz5CjvD=qhGxtht_2YKuygL1g@mail.gmail.com>

Dan Stromberg wrote:
> On Mon, May 8, 2023 at 8:03 AM Felipe Contreras
> <felipe.contreras@gmail.com> 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

  reply	other threads:[~2023-05-08 17:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-28 15:34 Weird merge records Dan Stromberg
2023-05-06 14:43 ` Thomas Guyot
2023-05-07 20:34   ` Felipe Contreras
2023-05-08 14:53     ` Dan Stromberg
2023-05-08 15:03       ` Felipe Contreras
2023-05-08 16:53         ` Dan Stromberg
2023-05-08 17:17           ` Felipe Contreras [this message]
2023-05-08 14:54   ` Dan Stromberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=64592e8e848f2_8a9f294a3@chronos.notmuch \
    --to=felipe.contreras@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=strombrg@gmail.com \
    --cc=tguyot@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).