How to use the git alias?
I have configured them in ~/.gitconfig
:
[alias]
g = "git"
go = "git checkout"
And I can see them with 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 aliases are used for git, meaning:
your alias file should be something like:
[alias]
co = checkout
and be used like git co <args>
the alias is used only for the after 'git' command.
You have to type
git g
or
git go
First, as another user pointed out, you have to use git aliases only inside 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.
alias gs='git status'
alias go='git checkout'
Hope it helps
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.