node-gh / gh

(DEPRECATED) GitHub CLI made with NodeJS. Use the official https://cli.github.com/ instead.
http://nodegh.io
Other
1.71k stars 217 forks source link

Prepend username to branch name when fetching from other's repo #583

Open dantewang opened 5 years ago

dantewang commented 5 years ago

For example, can we make gh pr 100 fetches the PR on my repo to local branch pr-100, while gh pr 100 -u johndoe fetches the PR on John Doe's repo to local branch john-doe-pr-100?

protoEvangelion commented 5 years ago

@dantewang That is a good use case thanks for bringing it up.

In ~/.gh.json there is a field that we could leverage to do this: "pull_branch_name_prefix": "pr-",.

One approach might be to add something like "pull_branch_name_prefix": "{{options.user}}-pr-", and where we set the branch name dynamically add the user name at that point.

If you are interested the relevant code to make this change would be here: https://github.com/node-gh/gh/blob/master/lib/cmds/pull-request.js#L417

Altofersquare commented 3 years ago

@dantewang That is a good use case thanks for bringing it up.

In ~/.gh.json there is a field that we could leverage to do this: "pull_branch_name_prefix": "pr-",.

One approach might be to add something like "pull_branch_name_prefix": "{{options.user}}-pr-", and where we set the branch name dynamically add the user name at that point.

If you are interested the relevant code to make this change would be here: https://github.com/node-gh/gh/blob/master/lib/cmds/pull-request.js#L417