简体   繁体   English

无法在Windows 7上的MinGW32中创建简单的Git别名

[英]Cannot create simple Git alias in MinGW32 on windows 7

I am trying to create a very simple alias. 我正在尝试创建一个非常简单的别名。 I want alias the following command: 我想要别名以下命令:

git log --oneline --graph --all -- decorate

I find this command a very useful way to view the log file. 我发现此命令是查看日志文件的一种非常有用的方法。 I want to alias this line as git l because its the main way I wish to view the log file. 我想将此行别名为git l因为它是我希望查看日志文件的主要方式。 This is my attempt to create the alias: 这是我尝试创建别名:

git config --global alias .l "git log --oneline --graph --all -- decorate"

This line executes without error, but then any attempt to call git l results in the following error message. 此行执行时没有错误,但是任何尝试调用git l导致以下错误消息。

Expansion of alias 'l' failed; 'git' is not a git command

It was explained that working environment, windows 7, minGW32, and git version 1.8.3.msysgit.0 could have something to do with this issue, but I am not sure how to resolve this. 据解释,工作环境,Windows 7,minGW32和git版本1.8.3.msysgit.0可能与此问题有关,但我不知道如何解决这个问题。 Thank you to anyone who helps out. 感谢任何帮助过的人。

It should be: 它应该是:

git config --global alias.l "log --oneline --graph --all --decorate"

To call something other than a git command, you would prefix it with an exclamation point: 要调用除git命令之外的其他内容,您将在前面添加一个感叹号:

git config --global alias.foo "!foo --do-something"

In your case, it could've been: 在你的情况下,它可能是:

git config --global alias.l "!git log --oneline --graph --all --decorate"

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

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