-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Description
Ported from #251 (comment) with improvements.
Describe the feature or problem you’d like to solve
A simple way to target the fork instead of the original repo with any command.
Use cases:
I have some forked repositories that I maintain & work on myself, with all intentions to target the fork's issues, PRs etc., and not the original repository.
Examples:
- ESLint config (https://github.com/sarpik/eslint-config-sarpik)
- Dotfiles (https://github.com/sarpik/voidrice)
- Dotfile installer with custom program list (https://github.com/sarpik/LARBS)
- Suckless terminal with custom patches (https://github.com/sarpik/st)
as you can see, these are all forks that are specific specifically to my specific use case. (lol)
There are no intentions to merge them back or interact with the original repository, except for seeing how many commits the repos have diverged, being open about the fact that the repo is forked and having it in the list of forks at the original repository etc.
Currently, with https://github.com/github/hub, I've set-up the following git aliases to allow me to have a comfortable workflow with such cases:
# replace `sarpik` with your github username
[alias]
prme = pull-request --push -a sarpik --base master -epo # targets upstream
prmee = !hub pull-request --push -a sarpik --base sarpik:master -epo --head sarpik:"$(git symbolic-ref --short HEAD)" # targets origin (your repo)
prmed = pull-request --push -a sarpik --base master -depo # targets upstream
prmeed = !hub pull-request --push -a sarpik --base sarpik:master -depo --head sarpik:"$(git symbolic-ref --short HEAD)" # targets origin (your repo)Proposed solution
I can think of maybe having something like a "local" option, which makes any command operate on the local repo (the repository you forked, not the original one), something like -l, --local,
or allow selecting the remote, just like that's hub allows you to, say --head--repo, but also provide some sugar to make it easier - for example:
a) if the --repo option is not provided - do whatever you do currently;
a) if it is provided with a specified head - use that;
a) could we possibly allow a less verbose format for --repo?
something like only providing the OWNER and using the current repo's name as the REPO automatically?
a) (!) if the --repo option is provided without anything specified - default to the local repo (if that's even possible).
Additional context
This would allow simplier alias set-ups, such as the alias examples shown in #294 & here - above.
Thanks & best of luck with the cli!
Edit:
I really like the idea of @bbutkovic @ #251 (comment):
Perhaps we could add some sort of a flag (--self) to actually open a PR on the current repo instead of fork if someone does end up needing this.
but allow this not only for PRs, but also for issue & any other commands that can either operate.
This would make things way simplier, because you could share your aliases with others without either them having replace the user & repo.
So the request is to either improve the --repo option, or add a new option - something like --self.
P.S.
If https://github.com/github/hub still matters, could we also get a similar feature there for the --head option?
The alias example shown above could really use it for good,
but I assume that if the gh cli will provide this functionality,
it's probably unnecessary.