[英]I can't use my git alias
How to use the git alias? 如何使用git别名?
I have configured them in ~/.gitconfig
: 我已经在~/.gitconfig
配置了它们:
[alias]
g = "git"
go = "git checkout"
And I can see them with git config --get-regexp alias
: 我可以用git config --get-regexp alias
看到它们:
alias.g git
alias.go git checkout
But when I try to use them, it displays the following: 但是当我尝试使用它们时,它将显示以下内容:
$ g
g: command not found
$ go
The program 'go' is currently not installed. You can install it by typing:
sudo apt install golang-go
How cai I make them to work? 我怎么才能让他们工作?
git alias are not used like that. git别名不是那样使用的。 git aliases are used for git, meaning: git别名用于git,意思是:
your alias file should be something like: 您的别名文件应类似于:
[alias]
co = checkout
and be used like git co <args>
并像git co <args>
the alias is used only for the after 'git' command. 别名仅用于'git'之后的命令。
You have to type 您必须输入
git g
or 要么
git go
First, as another user pointed out, you have to use git aliases only inside git. 首先,正如另一个用户指出的那样,您必须仅在git内部使用git别名。 What it means is that your aliases must be used like this : 这意味着您的别名必须这样使用:
git ALIAS ...
Then, don't put any " " around your aliases (but you could, there's nothing wrong with it). 然后,不要在别名周围放置任何“”(但是您可以,没有问题)。 Just write them like this : 像这样写它们:
[alias]
co = checkout
ci = commit
st = status
If you want to setup aliases to call git with, you have to add them to your ~/.bashrc file. 如果要设置别名以调用git,则必须将它们添加到〜/ .bashrc文件中。
alias gs='git status'
alias go='git checkout'
Hope it helps 希望能帮助到你
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.