git-extras
git-extras copied to clipboard
Question about using git pr
When reviewing PR's, I use git pr a lot, and I am very grateful to have it.
Now that GitHub allows pushing to changes back to the original source branch for a PR (assuming the submitter has allowed this) what would be required, or should be used in conjunction with git pr, to allow the easy checkout of the PR branch, but also allow local changes and pushing back?
Thanks in advance!
Hi!
I don't know about this feature. To me, it sounds like you should be able to to just push your changes, like with any other branch. Have you tried that?
@nicolaiskogheim yes, I have tried that, but I am not clear on what will happen, and I guess that is why I happened progressed it.
For example, I have just done git pr 1419 on a repository that I help out on, and this is what I get:

And this is the PR in question:
https://github.com/cake-build/cake/pull/1419
When I try to push I get asked to set the upstream on origin, but this isn't really what I would like to do. I would like to make a commit, and push to the original branch on the remote repository, i.e what is being suggested here:

I would love the speed of simply doing git pr combined with the ability to pushing to the original repository.
Any ideas? Thanks!
Ah, I see.
I'm on the bus now, but I'll try and solve this when I'm back at my computer.
Den 09.04 Ons 28. Des 2016 skrev Gary Ewan Park [email protected]:
@nicolaiskogheim https://github.com/nicolaiskogheim yes, I have tried that, but I am not clear on what will happen, and I guess that is why I happened progressed it.
For example, I have just done git pr 1419 on a repository that I help out on, and this is what I get:
[image: image] https://cloud.githubusercontent.com/assets/1271146/21517089/ee5e651a-ccd3-11e6-8673-eac97975848f.png
And this is the PR in question:
cake-build/cake#1419 https://github.com/cake-build/cake/pull/1419
When I try to push I get asked to set the upstream on origin, but this isn't really what I would like to do. I would like to make a commit, and push to the original branch on the remote repository, i.e what is being suggested here:
[image: image] https://cloud.githubusercontent.com/assets/1271146/21517115/23e16a98-ccd4-11e6-973b-1f7e09dcc417.png
I would love the speed of simply doing git pr combined with the ability to pushing to the original repository.
Any ideas? Thanks!
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/tj/git-extras/issues/608#issuecomment-269441394, or mute the thread https://github.com/notifications/unsubscribe-auth/ACBQBID1EfCQ3ZQU5HVw_M9PyvJb6Ronks5rMhgUgaJpZM4LO-iH .
@nicolaiskogheim sweet! Let me know if you need a guinea to test something out.
I personally think that this workflow would be very useful, and speed up the process of updating a PR that is submitted to a given repository. Thanks again for taking the time to look at this.
@gep13 Could you open a pr on my fork? And enable that feature so I can push to your branch.
@nicolaiskogheim sure thing...
https://github.com/nicolaiskogheim/git-extras/pull/1
Thanks.
Now that GitHub allows pushing to changes back to the original source branch for a PR (assuming the submitter has allowed this)
I'm not able to find anything on this. Do you have a link to where you got this information?
Another question: When you use git-pr, are you able to git pull to get new commits?
@nicolaiskogheim said... I'm not able to find anything on this. Do you have a link to where you got this information?
I first learned about this feature on a blog post from GitHub, which you can find here:
https://github.com/blog/2247-improving-collaboration-with-forks
@nicolaiskogheim said... Another question: When you use git-pr, are you able to git pull to get new commits?
No, after doing git pr I am not able to do anything with the branch that is created:

When I have actually needed to do something with a PR, i.e. to update it, or rebase it, I would normally go through the following type of process:
git clone https://github.com/phillipsj/cake.git
git checkout GH1369-msbuild-2017-support
git remote add upstream https://github.com/cake-build/cake.git
git fetch upstream develop
git rebase upstream/develop
git push -f
Where I had to go and look up the https://github.com/phillipsj/cake.git and the branch name GH1369-msbuild-2017-support in order to allow this to happen. If those could be set up during the git pr, it would be amazing 😄
@nicolaiskogheim just wanted to touch base on this. Were you able to get anywhere? Thanks!
Hi!
Yes, I made some progress, but then I was suddenly occupied with some unrelated work, and still is. I will try and get back to this soon.
@nicolaiskogheim said... I was suddenly occupied with some unrelated work, and still is.
Not a problem at all, totally understand that. Just wanted to check in to see if there was anything I could help with. Thank you for looking at this.
Just chiming in to say I haven't forgotten this.
@nicolaiskogheim said... Just chiming in to say I haven't forgotten this.
Thanks for touching base, appreciate it.
@nicolaiskogheim how are you? Just wanted to touch base to see if you had made any progress with this. Do you think it is possible? Thanks!
@nicolaiskogheim how are you? Just wanted to touch base again with this. Any joy? Thanks
Hi! Time flies, hehe. Sorry for taking forever to come back to this. I'll look at this again tomorrow. Thank you for being patient :)
That is great news! Thank you for doing this! Please let me know if there is anything that you need me to help out with.
Would be very cool to be able to git pull after a "git pr" call.
@nicolaiskogheim hello again 😄 Just wanted to touch base on this issue again. Have you had a chance to look at this?
This would be awesome indeed. I hope @nicolaiskogheim hasn't abandoned the project.
I'm so sorry guys. I'm overworked at the moment. Keep pinging me and I'll get back to you. I may have an opening next week.
@nicolaiskogheim perfect! 😄 Again, let me know if there is anything I can do to help, or if you need anything tested.
@nicolaiskogheim how are you? Just wanted to follow up with this question again. Is this still something that you are thinking about helping out with? Thanks.
Hey! I gave this a shot a couple of days ago, but so far I'm not able to find out from the command line what branch the PR was created from. I'll try some more next week probably.
I've been looking into this too and I don't believe it's possible. Information about the fork and its branch doesn't exist because this isn't a native feature of Git branches, therefore it's not possible to add the remote and the upstream branch for the checked out branch.
Tools such as hub set the upstream branch because they use the GitHub API which exposes all the information needed.
@johnbillion thanks for following up with this. That is a real shame, but I understand what you are saying.
Hi there was there any progress on this? I have the same ask - after doing a git pr on a contribution to my repo, I'd like to push back changes
@pliablepixels I have actually been meaning to come back and update this issue... thanks for the prod!
I have started using the official GitHub CLI which now allows me to do this...
gh pr list
And then:
gh pr checkout <pr number>
Once checked out, you can make changes and submit directly back to the fork the PR came from.
I would recommend that you check it out:
https://github.com/cli/cli
Oh very nice! I just uninstalled git extras and installed git cli. Thanks @gep13!