hub alias hides git-alias #153

cdlm opened this Issue Mar 26, 2012 · 9 comments


None yet

5 participants


hub alias does not seem to take --noop into account, so it hides git-alias from

Since it's a hub-specific command, and it's only useful at setup time, I propose to either:

  • make it aware of --noop
  • hide it as an option rather than a command, i.e. hub [--alias|--shell-alias] [SHELL]
  • make it work only if $0 is explicitly hub
GitHub member

It took me a while to figure out what you're saying. Basically, hub alias shadows the other git-alias commands that may exist on the system (in this case, one is provided by git-extras), right?

I'm in favor of your proposal 3. However, this behavior might be surprising to some because in every other case, calling hub <something> should be identical to git <something> (when hub is aliased as git). I need to think about it.

Thanks for the heads-up!


Sorry if I wasn't clear; you understood me correctly.


Could something like hub alias-command work just as well, and be a bit more clear?

Or something similar...

GitHub member

First of all, --noop doesn't forward all commands to git. It just shows what would be executed by hub, but doesn't execute it.

I like the idea of making hub alias only work if the command was invoked as hub and not git. However, I don't know how to do this technically; the value of $0 is hub for me regardless whether I invoked it through a git alias or not.

Next option is to make it a custom flag such as hub --alias. However this breaks backwards compatibility with people who already embedded eval "$(hub alias -s)" is a shell.


@cdlm @mislav Does hub make git-extras aliases useless if I've git aliased to hub? Can't I use any of the awesome git-extras aliases mentioned here ?

GitHub member

You can use all of the git-extras command except for git alias and git fork from that repo, because hub alias and hub fork will take precedence.


You can use git-alias and git-fork instead, or bypass the git alias with \ (backslash): \git alias. I'm not a go expert, but I've been messing around and no matter how I run the go executable os.Args[0] always gives the true name of the executable, which is hub, as @mislav said.

In the case of hub alias perhaps you can use the fact that -s is passed to run hub alias, otherwise print a deprecation notice or forward over to the git command.

GitHub member

For any command if you want to skip hub altogether from your shell, just do command git .... E.g. command git alias.


Yep, and that has the same effect as using backslash \, e.g. \git

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment