Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add command to checkout a pull request branch #20

Open
jcansdale opened this issue Dec 9, 2018 · 0 comments
Open

Add command to checkout a pull request branch #20

jcansdale opened this issue Dec 9, 2018 · 0 comments

Comments

@jcansdale
Copy link
Owner

@ethomson has some tips on how to checkout PRs here:
http://edwardthomson.com/blog/advent_day_5_review_pull_requests_locally.html

After some initial configuration, this allows checking out a PR like this:

git fetch pr
git checkout pr/1234

It would be nice if git pr supported something similar. For example:

git pr checkout 1234

This would locate the pull request branch and checkout that (rather than the pull request reference). The advantage of using the branch rather than the reference would be the user could push to the branch if they're the repository owner/collaborator.

If the pull request was submitted be an external contributor, the contributor/remote name would need to be specified:

git pr checkout 1234 --remote {contributor}

I've been wondering what a sensible format for the local branch would be. It could contain information about the PR number, owner and/or branch name:

pr/1234/contributor/branch-name
pr/1234/branch-name
branch-name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant