简体   繁体   English

从cmder使用git别名

[英]Using a git alias from cmder

I use Bash to work with Git and, using a combination of Git and Bash aliases, am able to execute commands like "gs" for git status. 我使用Bash与Git结合使用,并且结合使用Git和Bash别名,能够执行git status之类的命令“ gs”。

Having installed cmder I am able to set an alias for git. 安装了cmder之后,我可以为git设置别名。 However, I am unable to execute a git command using the "g" alias - I just get the git usage page. 但是,我无法使用“ g”别名执行git命令-我只得到git用法页面。 I can run "git s" (so it is using my global gitconfig file for the git aliases). 可以运行“ git s”(因此它使用我的全局gitconfig文件作为git别名)。 So through cmder I have access to both its aliases as well as the git aliases but I can't seem to use them together. 因此,通过cmder,我可以同时访问其别名和git别名,但似乎无法一起使用它们。

With bash I don't seem to have a problem. 使用bash似乎没有问题。

Apparently cmder uses the default convention of having a $ as an argument variable. 显然,cmder使用将$作为参数变量的默认约定。 Thus, in my case, to make git=g I put: 因此,在我的情况下,为了使git=g我放:

alias g=git $*

in order for git to handle any and all arguments. 为了让git处理所有参数。

I had been struggling for a month on and off, only to (rather embarrasingly) find it on the homepage for cmder ( http://cmder.net/ ) 我一直在挣扎一个月或一个月的苦苦挣扎,只是(以令人尴尬的方式)在cmder( http://cmder.net/ )的主页上找到它。

At the bottom of said page it has a small section on Aliases. 在该页面的底部,有一小部分关于别名。 You'll find my source there... 您会在这里找到我的来源...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM