【问题标题】:Cannot create simple Git alias in MinGW32 on windows 7无法在 Windows 7 上的 MinGW32 中创建简单的 Git 别名
【发布时间】:2013-07-10 04:31:46
【问题描述】:

我正在尝试创建一个非常简单的别名。我想要以下命令的别名:

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

我发现此命令是查看日志文件的非常有用的方法。我想将此行别名为git l,因为它是我希望查看日志文件的主要方式。这是我创建别名的尝试:

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

此行执行没有错误,但任何尝试调用 git l 都会导致以下错误消息。

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

有人解释说工作环境,windows 7,minGW32,和git版本1.8.3.msysgit.0可能与这个问题有关,但我不知道如何解决这个问题。感谢任何提供帮助的人。

【问题讨论】:

    标签: windows git alias mingw32


    【解决方案1】:

    应该是:

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

    要调用 git 命令以外的东西,你可以在它前面加上一个感叹号:

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

    在你的情况下,它可能是:

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

    【讨论】:

    • 完美,谢谢,我应该输入的是git config --global alias .l "log --oneline --graph --all -- decorate"
    • 在我的情况下,我必须在 ! 之前添加一个空格,否则它会显示 Expansion of alias 'visual' failed; 'gitk' is not a git command
    猜你喜欢
    • 2012-05-14
    • 1970-01-01
    • 1970-01-01
    • 2011-01-15
    • 1970-01-01
    • 1970-01-01
    • 2020-01-26
    • 2018-01-10
    相关资源
    最近更新 更多