git 中的大写别名
Uppercase alias in git
我正在尝试为 git s
和 git S
创建一个别名到 运行 git status
。问题是 git 似乎总是强制我的别名小写。有解决办法吗?
下面我尝试将大写 K
别名为 status,但它被更改为小写 k
server[18]:/.../src$ git S
git: 'S' is not a git command. See 'git --help'.
Did you mean one of these?
d
l
s
server[19]:/.../src$ git config --global alias.K status
server[20]:/.../src$ git S
git: 'S' is not a git command. See 'git --help'.
Did you mean one of these?
d
k
l
s
git config
确实提到:
The variable names are case-insensitive, allow only alphanumeric characters and -, and must start with an alphabetic character
所以你不可能为同一个字母定义两个别名。
It looks like capital aliases are not valid, is there a workaround for that?
是的,不要定义别名,而是将 $PATH(如果你不在 Windows 上)放入名为 git-s
和 [=12 的常规 bash 脚本(无扩展名) =]: 任何名为 git-xxx
的脚本都可以被称为 git xxx
.
我正在尝试为 git s
和 git S
创建一个别名到 运行 git status
。问题是 git 似乎总是强制我的别名小写。有解决办法吗?
下面我尝试将大写 K
别名为 status,但它被更改为小写 k
server[18]:/.../src$ git S
git: 'S' is not a git command. See 'git --help'.
Did you mean one of these?
d
l
s
server[19]:/.../src$ git config --global alias.K status
server[20]:/.../src$ git S
git: 'S' is not a git command. See 'git --help'.
Did you mean one of these?
d
k
l
s
git config
确实提到:
The variable names are case-insensitive, allow only alphanumeric characters and -, and must start with an alphabetic character
所以你不可能为同一个字母定义两个别名。
It looks like capital aliases are not valid, is there a workaround for that?
是的,不要定义别名,而是将 $PATH(如果你不在 Windows 上)放入名为 git-s
和 [=12 的常规 bash 脚本(无扩展名) =]: 任何名为 git-xxx
的脚本都可以被称为 git xxx
.