GitHub clone from pull request?
The easiest way to do that is like this:
git fetch origin pull/2/headgit checkout -b pullrequest FETCH_HEAD
You will now be on a new branch that is on the state of the pull request.
You might want to set up an alias by running
git config --global alias.pr '!f() { git fetch -fu ${2:-origin} refs/pull/$1/head:pr/$1 && git checkout pr/$1; }; f'
Now you can checkout any PR by running git pr <pr_number>
, or git pr <pr_number> <remote>
if your github remote is not named origin
.
You can clone the branch you want by using the -b
option and for pull request:
git clone https://github.com/user_name/repo_name.git -b feature/pull_request_name dir_name
In your case, the branch you want to clone is the source branch of the pull request (feature/mongoose-support
):
git clone https://github.com/berstend/frappe.git -b feature/mongoose-support ./mongoose-support
git fetch origin refs/pull/PR_NUMBER/head:NEW_LOCAL_BRANCH
eg:
git fetch origin pull/611/head:pull_611git checkout pull_611
Make changes, commit them, PUSH and open new PR from your fork on GitHub