我很好奇,想知道是否可以在Git的制作别名,即元别名创建一个别名,以便不用打字git config --global alias.
-whatever一个能只要写git alias
- 无论如何。
背景:
我只升温到Bash和Git的,并且最近已经开始创建别名像
git cfg
为git config --global
和,from this page,git hist
为:git log --pretty=format:"%h %ad | %s%d [%an]" --graph --date=short
最后一个例子通过键入:
git config --global alias.hist 'log --pretty=format:"%h %ad | %s%d [%an]" --graph --date=short'
随着我
git cfg
别名我可以缩短,为:git cfg alias.hist 'log --pretty=format:"%h %ad | %s%d [%an]" --graph --date=short'
但我想弄清楚,如果我能缩短它更进一步使git cfg alias.
只是git alias
,部分出方便,部分出于好奇,部分原因是想了解更多关于Git和Bash的内容。
尝试的解决方案?:
我发现我可以打电话
git $(echo 'cfg')
,并得到相同的结果git cfg
。希望我能像键入一些git alias st status
创建一个快捷别名git st
为git status
git cfg alias.alias '$(echo "config --global alias.")'
:
所以,我想通过输入此创建别名为
alias
。不幸的是,这似乎并没有在这一点上的Git不再承认
$(echo
的命令,因为工作,即使它的工作别名的背景之外,与git $(echo 'cfg')
。我也不确定是否工作,因为示例中的st
必须从执行的回显中直接附加到alias.
。
有没有人有任何建议,如何使这成为可能?
这不仅工作,但解释也有帮助:-)谢谢! – guypursey 2013-05-06 09:26:45