[HTCondor-devel] fetching github pull requests


Date: Wed, 24 Apr 2019 15:31:00 -0500 (CDT)
From: Carl Edquist <edquist@xxxxxxxxxxx>
Subject: [HTCondor-devel] fetching github pull requests
Hi all,

I was just discussing this with Jaime -

If someone makes a github pull request against the htcondor mirror, it is not necessary to take the diffs and manually re-create commits locally. It is possible to fetch the commits directly for a github pull request down to your local git repository.

You can set up a separate remote for this in your local condor repo, eg:

	$ git remote add PR https://github.com/htcondor/htcondor
	$ git config remote.PR.fetch "+refs/pull/*/head:refs/remotes/PR/*"
	$ git fetch PR

This will create a remote called "PR", and, for example, you can access the commit for github pull request 23 as "PR/23". You can pass that in as an argument to gitk, git-diff, git-checkout, git-merge, etc.

If you want to merge a PR into master (or whatever branch the PR submitter requested), you can do that with:

	$ git merge PR/23

and when push your changes back to the main AFS repo, then github will see the PR got merged and mark it as merged/closed.


If you get tired of having all the remote PR refs in your local git repo, you can remove them all simply by removing the remote:

	$ git remote rm PR


Hopefully you may find this useful,

Carl
[← Prev in Thread] Current Thread [Next in Thread→]