-
Notifications
You must be signed in to change notification settings - Fork 3
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
[Proposal]: Checkout PR command #27
Comments
Thoughts @Leo6Leo ? |
So basically it is a command that can check out according to PR. Just want to ask you several questions to help me better understand the feature: Take git-utils as an example: I downloaded the Leo6Leo/git-utls.git on my Mac. Scenario 1:
What will the command do? Scenario 2:
(Assume Leo6Leo#1 exist) Scenario 3:
What will the command do? Scenario 4:
What will the command do? |
@Leo6Leo I imagine that: Scenario 1: this would go and see if pull/22 was from a fork or not. If it was from a fork, it would add the appropriate remote and then create a new branch from that remote. Scenario 2: this would again go and see if pull/1 was from a fork or not. Also, if Leo6Leo/git-utils is not a remote on the current repo, it would create a remote to it if pull/1 was not from a fork. Scenarios 3 & 4: no pull URL was provided, so it will tell them to have an appropriate PR url WDYT? |
Wdym "if pull/22 was from a fork or not"? If it is from a fork, do you mean PR#22 is a PR in Leo6Leo/git-util? Let me make this more clear by having some more cases: Case 1Cali0707 created the upstream repo Cali0707/git-utils, and Leo6Leo forked it and has Leo6Leo/git-utils The PR links I used in the text below are valid. Scenario 1Leo6Leo try to git checkout-pr a pr from cali0707/git-utils because he needs to review one of Cali's PR. This PR is not from a fork, and as expected, it should clone the Cali0707/git-utils repo, and checkout to Scenario 2Leo6Leo try to git checkout-pr a pr from Leo6Leo/utils because he needs to review one of his own PR. This PR is from a fork, and as expected, it should just directly checkout to Scenario 3Cali0707 try to git checkout-pr a pr from Cali0707/git-utils because he needs to review one of his own PR. This PR is by Leo6Leo, and Leo6Leo is trying to merge Leo6Leo/git-util.git This PR is not from a fork, and as expected, it should clone the Cali0707/git-utils repo, and checkout to ...... A bit sleepy rn, let's discuss this in person cali 🥱 @Cali0707 |
Per conversation with @Leo6Leo :
|
Problem Description
Currently, if you need to check out a branch from a PR to test it locally, you need to figure out if it is on a fork or a branch that exists in the repo. Then, if it is a fork, you need to add a remote to that fork and then checkout the relevant branch.
Proposed solution
Add a command that would operate something like
git checkout-pr <pr_url>
, and figure out whether or not the branch referred to in the url is on a fork or the main repo. It would set up any necessary remote and then checkout the appropriate branch. It is also worth considering adding a "cleanup" command or option here, that removes the remote and deletes the branch once you are done.The text was updated successfully, but these errors were encountered: