Git question

Ryan Schmidt ryandesign at macports.org
Mon Jan 13 19:14:56 UTC 2020



On Jan 10, 2020, at 03:34, Gerben Wierda wrote:

> If I produce a pull request and I’m rebuffed because of an error I make, I need to go back to testate of the official repository before proceeding again.

I think you should reexamine how you are using git, because "reset" is not a git command I ever run in the normal course of my contributions to MacPorts, and you shouldn't need to either.

Here's how to use git:

Your fork's master should remain pristine. You won't ever commit to it. Periodically, you'll pull in new changes from macports/macports-ports into your fork to keep it up to date.

When you want to propose a change, you'll copy your master to a new branch. You'll add commits to that branch to do what you want to do. You'll push the branch to the GitHub copy of your fork and submit a PR from that. If a pull request reviewer asks you to make additional changes, you can just add commits to that branch and push it again. You can rebase that branch to squash the commits into one or a few (and then force-push it), or all the commits can be squashed into one in the GitHub web interface by the person who merges your PR.

Occasionally it may become necessary for you to rebase your branch onto an updated master, if master is updated in such a way that impacts your work (for example someone else commits changes to the same port you were submitting a PR for). (And then you would force-push it.) But otherwise rebasing wouldn't be necessary.

When your PR is merged, the web interface will show you a button letting you delete the GitHub copy of your branch. You can then manually delete the local copy of your branch.



More information about the macports-users mailing list