gh icon indicating copy to clipboard operation
gh copied to clipboard

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

Open dantewang opened this issue 7 years ago • 2 comments

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?

dantewang avatar Nov 08 '18 06:11 dantewang

@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

protoEvangelion avatar Nov 08 '18 18:11 protoEvangelion

@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 avatar Oct 05 '20 05:10 Altofersquare