Vscode-pull-request-github: Pull requests should be checked out without adding a remote locally

Created on 27 Jun 2018  路  4Comments  路  Source: microsoft/vscode-pull-request-github

It's possible to fetch PR changes without adding a remote:

git pull --no-rebase origin refs/pull/PR_NUMBER/head

https://help.github.com/articles/checking-out-pull-requests-locally/

feature-request

Most helpful comment

We created remotes for the remote branch just in case if you want to make changes and push to that branch. AFAIK, refs/pull/PR_NUMBER/head is a readonly copy of the Pull Request so users need additional steps (for example knowing which remote/branch it should be bind to) when they want to push.

All 4 comments

We created remotes for the remote branch just in case if you want to make changes and push to that branch. AFAIK, refs/pull/PR_NUMBER/head is a readonly copy of the Pull Request so users need additional steps (for example knowing which remote/branch it should be bind to) when they want to push.

just in case if you want to make changes and push to that branch

It's a little bit strange case, because PR reviewers usually don't have write access to PR author's fork, from which, usually, PR was created (except case when PR created between branches in one repository).
Also, that behavior requires manual cleanup of the remotes list in the local repository after several PRs review.

It would be nice to create the config option for default PR fetch behavior - 'fetch from remote' or 'fetch from refs/pull/N/head'.

I work an an environment where we do have push permissions on the remotes we are reviewing (this is the default on github for repository maintainers) and would really appreciate this functionality.

It is one of the blockers for me to use the github pull request plugin over hub (https://github.com/github/hub). With hub's checkout functionality, it will checkout and add push support without adding remotes. This avoids local clutter (having hundreds of remotes locally after reviewing many PRs from different users). This is done by specifying the remote inside .git/config:

[branch "use-gameplay-clock-current-time"]
    remote = https://github.com/iiSaLMaN/osu.git
    merge = refs/heads/use-gameplay-clock-current-time
Was this page helpful?
0 / 5 - 0 ratings