-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow specifying the git remote name for a command #1973
Comments
I think allowing git remote get-url up | sed -E 's|.*/(\w+/\w+)|\1|' # returns org/repo Would work. Then the |
For anyone else hitting this issue, I'm working around it by using: curl \
-H "Authorization: token $(awk '$1 == "oauth_token:" { print $2; exit }' ~/.config/hub)" \
-d "{\"tag_name\":\"$tag\",\"name\":\"$tag\",\"body\":\"$(bin/changelog | awk '{printf "%s\\n", $0}')\",\"draft\":true}" \
https://api.github.<company>.com/repos/<org>/<repo>/releases in our release notes. |
Thank you for raising this issue and explaining your use-case and workarounds!
Yes, hub's behavior when none of the remotes is named "origin", "github", or "upstream" is not well documented (it just picks the first remote from
This should, roughly, already be the default behavior of I recommend you name your fork's remote "origin" and your upstream remote (one pointing to the canonical version of the project) "upstream". The idea for a
I'm sorry this has been difficult for you! If you named your upstream git remote one of "upstream", "github", or "origin", then the commands such as |
Yeah, I can see that
Yeah a If I get round to it maybe I'll try taking a look at the hub cli and working out how one would add support global flags. Thanks for being so responsive! |
I think the default should be "origin" not "upstream". It would be nice to have a % git remote -v
james https://github.com/JamesGlover/limber.git (fetch)
james https://github.com/JamesGlover/limber.git (push)
origin https://github.com/radome/limber.git (fetch)
origin https://github.com/radome/limber.git (push)
upstream https://github.com/sanger/limber.git (fetch)
upstream https://github.com/sanger/limber.git (push)
% hub release create release-0.2.1-os3
https://github.com/sanger/limber/releases/tag/release-0.2.1-os3 |
pull-request
and release create
to take a remote name
Totally agree, the default should be
Without explicit configuration, no assumptions should be made regarding remote names other than the canonical Examples for the
|
I like the idea of |
@friederbluemle I like the idea of something like github.com:
defaultremote: upstream, github, origin If it's a list of names, they would be looked up in order of preference and the first one that exists would be selected. Any user of hub could change this list to what they prefer. Finally, a remote could be explicitly set per-command with the |
I'd really like this since currently, in our studio, I've written a series of scripts to automate some of our git workflows using What I'd like to see is either a way to explicitly select which remote is used for API calls or be able to customize the priority that What's worse is that the verbose output doesn't include this information; it just includes specifics about the API call(s) being used, but not what remote it's using to hit, so troubleshooting issues becomes a headache. |
pull-request
When raising PRs, by default I want to raise a PR from the branch my current
HEAD
is tracking (which is on thefork
remote) to theHEAD
branch on the upstream repo (i.e. the default branch for theup
remote,refs/remotes/up/HEAD
).This is the current command I have to run to do this:
This resolves to something like:
I would like to be able to specify the remote name instead, so I could just do:
I'm thinking
hub
could work out that this is a remote-tracking branch name, and resolveup/dev
toupstream_org:dev
.remote create
I have the same problem with
hub release create
, except that here AFAICT there is no way to specify a remote name or an org name, given two remotes, neither called origin,hub
just picks one at random.hub release
does take a--commitish
flag, but that flag is passed directly to the GitHub API without being resolved.This makes
hub release create
unusable for us, as where the tag gets created is not clear.The text was updated successfully, but these errors were encountered: