Ritz
Ritz

Reputation: 1253

how to create aliases for full git commands

I created a git alias as follows but when I run git gbf4364 it throws an error, what am I missing?

git config --global alias.gbf4364 'git clone ssh://[email protected]:29418/projectname'

Upvotes: 2

Views: 97

Answers (1)

Wang Danyang
Wang Danyang

Reputation: 76

Git aliases are assumed to be git commands unless stated otherwise. Git simply replaces the new command with whatever you alias it for. However, maybe you want to run an external command, rather than a Git subcommand. In that case, you start the command with a ! character1.

As clone is a git subcommand, use git config --global alias.gbf4364 'clone ssh://[email protected]:29418/projectname', which will translate to git clone [...]

You shouldn't add git in the alias. Otherwise git gbft4364 equals to git git clone ssh://[email protected]:29418/projectname, it will have two git.

When you want to delete the alias, use git config --global --unset alias.gbft4364

Upvotes: 4

Related Questions