Open lacostej opened 5 years ago
Excellent suggestion; thank you for writing in!
The next feature release of hub will aim to name the remote for your fork origin
by default (and rename existing origin
to upstream
if it exists). After that change, it will be easier for scripts to guess the name of the fork since hub fork
will result in origin
by default, instead of the person's username.
However, even after that, we will still need a tool that looks up the git remote of one's fork, because we don't know whether the git remote was created with an old version of hub.
I'm imagining a new command that dumps information about the current repository in a machine-readable format for scripts. That command would help with looking up things like:
Anything else? Also, how do we imagine this command being called and what should its output look like?
I currently don't have a suggestion for how the output will look, but having the command be named
hub repo info
looks intuitive enough.
TL;DR: There doesn't seem to be a way to know the name of the remote of my current fork. I would need it to automate pushing commits.
Background: people have different conventions when naming upstream/fork their remote repositories. Common examples: upstream/origin, origin/$USER etc.
I am writing scripts to be used by a team, and those scripts use git and hub to automate the creation of some branches and pull-requests.
The workflow is similar to the one found in the default documentation:
My issue is that given that people name their
userremote
differently I either have to parametrize it, or fetch it, which can be achieved using the following ruby code:It would be much easier if hub was able to display some information, such as the username and the fork remote name.
I am willing to contribute it, but would gladly first get some feedback on whether this is a good idea and where it would make most sense to add the feature.