having trouble with pull requests

Ralph Seichter ralph at ml.seichter.de
Mon Jan 31 22:03:09 UTC 2022


* Stephen A. Langer:

> Are all the mistakes that I made in the initial submission baked into
> my fork?  Pmetzger advised me to start over, but it's not clear to me
> at which point I should start over.

Hard to say without knowing your repository state.

Here is how I have set things up for MacPorts, but it also applies to
contributions I make to other Git repositories.

  $ cd /path/to/my/macports
  $ git remote -v
  origin   git at github.com:rseichter/macports-ports.git (fetch)
  origin   git at github.com:rseichter/macports-ports.git (push)
  upstream git at github.com:macports/macports-ports.git (fetch)
  upstream git at github.com:macports/macports-ports.git (push)

  # Make sure we're on master first.
  $ git checkout master

  # Fetch changes from official MacPorts repository ("upstream").
  $ git fetch upstream

  # Merge changes into master.
  $ git merge upstream/master

  # Push updated master to my own MacPorts fork ("origin").
  $ git push origin master

  # Create and checkout new branch for my changes.
  $ git checkout -b mybranch-123

  # Check and/or change commit history. This can be done multiple times.
  $ git rebase -i origin/master

  # Push branch to my MacPorts fork.
  $ git push -u origin mybranch-123

After that, I can open a pull request. I can also keep rebasing and
pushing changes to mybranch-123 until both I and the reviewer are
satisfied (use "push -f ..." if necessary after a rebase).

Keeping upstream/master and origin/master in sync and rebasing usually
does the trick, and it might be all you need.

-Ralph


More information about the macports-dev mailing list