git-extras icon indicating copy to clipboard operation
git-extras copied to clipboard

Question about using git pr

Open gep13 opened this issue 8 years ago • 30 comments

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!

gep13 avatar Dec 16 '16 09:12 gep13

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 avatar Dec 26 '16 17:12 nicolaiskogheim

@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

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:

image

I would love the speed of simply doing git pr combined with the ability to pushing to the original repository.

Any ideas? Thanks!

gep13 avatar Dec 28 '16 08:12 gep13

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 avatar Dec 28 '16 17:12 nicolaiskogheim

@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 avatar Dec 28 '16 17:12 gep13

@gep13 Could you open a pr on my fork? And enable that feature so I can push to your branch.

nicolaiskogheim avatar Dec 28 '16 19:12 nicolaiskogheim

@nicolaiskogheim sure thing...

https://github.com/nicolaiskogheim/git-extras/pull/1

gep13 avatar Dec 28 '16 19:12 gep13

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?

nicolaiskogheim avatar Dec 29 '16 00:12 nicolaiskogheim

Another question: When you use git-pr, are you able to git pull to get new commits?

nicolaiskogheim avatar Dec 29 '16 00:12 nicolaiskogheim

@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:

image

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 😄

gep13 avatar Dec 29 '16 07:12 gep13

@nicolaiskogheim just wanted to touch base on this. Were you able to get anywhere? Thanks!

gep13 avatar Jan 11 '17 21:01 gep13

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 avatar Jan 12 '17 06:01 nicolaiskogheim

@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.

gep13 avatar Jan 12 '17 08:01 gep13

Just chiming in to say I haven't forgotten this.

nicolaiskogheim avatar Jan 27 '17 01:01 nicolaiskogheim

@nicolaiskogheim said... Just chiming in to say I haven't forgotten this.

Thanks for touching base, appreciate it.

gep13 avatar Jan 27 '17 08:01 gep13

@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!

gep13 avatar Mar 08 '17 11:03 gep13

@nicolaiskogheim how are you? Just wanted to touch base again with this. Any joy? Thanks

gep13 avatar Jul 20 '17 11:07 gep13

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 :)

nicolaiskogheim avatar Jul 21 '17 17:07 nicolaiskogheim

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.

gep13 avatar Jul 22 '17 12:07 gep13

Would be very cool to be able to git pull after a "git pr" call.

teto avatar Sep 15 '17 07:09 teto

@nicolaiskogheim hello again 😄 Just wanted to touch base on this issue again. Have you had a chance to look at this?

gep13 avatar Nov 03 '17 07:11 gep13

This would be awesome indeed. I hope @nicolaiskogheim hasn't abandoned the project.

dennisdoomen avatar Nov 03 '17 07:11 dennisdoomen

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 avatar Nov 03 '17 13:11 nicolaiskogheim

@nicolaiskogheim perfect! 😄 Again, let me know if there is anything I can do to help, or if you need anything tested.

gep13 avatar Nov 03 '17 14:11 gep13

@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.

gep13 avatar Sep 22 '18 14:09 gep13

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.

nicolaiskogheim avatar Sep 29 '18 16:09 nicolaiskogheim

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 avatar Mar 17 '19 12:03 johnbillion

@johnbillion thanks for following up with this. That is a real shame, but I understand what you are saying.

gep13 avatar Mar 17 '19 18:03 gep13

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 avatar Sep 13 '20 12:09 pliablepixels

@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

gep13 avatar Sep 13 '20 15:09 gep13

Oh very nice! I just uninstalled git extras and installed git cli. Thanks @gep13!

pliablepixels avatar Sep 13 '20 19:09 pliablepixels