Working with Git

Lawrence Velázquez larryv at
Mon Oct 31 10:04:08 PDT 2016

> On Oct 31, 2016, at 11:29 AM, Ryan Schmidt <ryandesign at> wrote:
>> On Oct 5, 2016, at 9:53 PM, Ryan Schmidt <ryandesign at> wrote:
>> How will this work on GitHub?
>> The user will submit a pull request. How do I test it locally? What if the pull request is incomplete? I know I can tell the user what's wrong, and they can push another commit to the same branch they made to initiate the pull request, and those new commits will automatically appear in the pull request, and I can then merge it if I like it. But what if the user does not respond and fix the changes? What if the user makes additional commits but they're still not sufficient? How do I take the user's pull request, make additional changes, and commit them to our master?
> There were several different and sometimes conflicting answers to this question in this thread. Now that we have converted to git, and I have received a pull request for one of my ports, I need to know how to test it locally and then commit it to master. I don't want to understand git's theory or to be given lots of options amongst which to choose; I just want to be told how to get my work done.

Here are some rough instructions. These will have to be refined; let me
know if you have any problems. I'm writing this in a bit of
a sleep-deprived fog.

To the right of the big green "Rebase and merge" button on the PR page,
you should see a link to view "command line instructions". Those
instructions are almost what you want, but you'll have to tweak them to
avoid merge commits.

To obtain the submitter's changes:

	$ git fetch curl-ca-bundle-update
	$ git checkout -b l2dy-curl-ca-bundle-update FETCH_HEAD
	$ git rebase master l2dy-curl-ca-bundle-update

The first command imports changes from the submitter's
"curl-ca-bundle-update" branch. The second command creates a new local
branch to match. The third command transplants the submitter's changes
onto the top of your master branch. (Rebasing will fail if the
submitter's changes don't apply cleanly to the current ports tree. You
can just ask them to fix this themselves and push a new branch.)

Now you can check out the new branch and try out the submitter's
changes. You can also modify the branch as you see fit.

	$ git checkout l2dy-curl-ca-bundle-update

When you're ready to push the submitter's contributions to master:

	$ git checkout master
	$ git merge --ff-only l2dy-curl-ca-bundle-update
	$ git push origin master

The first two commands incorporate the submitter's changes into your
master branch. The last one pushes to GitHub.

> Could someone please update the WorkingWithGit page with the correct instructions?

Yes, I will polish up that page this week, as well as the migration FAQ.


More information about the macports-dev mailing list