我对 Git 还比较陌生,所以也许我在做一些愚蠢的事情,但我有一个奇怪的问题......
我为 定义了一个stage
别名add --all
,因为我发现它更短且更不言自明:
D:\MyProject [master +0 ~1 -1]> git config alias.stage "add --all"
D:\MyProject [master +0 ~1 -1]> git config alias.stage
add --all
但是当我运行时git stage .
,它的行为就好像该--all
选项被省略了:
D:\MyProject [master +0 ~1 -1]> git stage .
warning: You ran 'git add' with neither '-A (--all)' or '--ignore-removal',
whose behaviour will change in Git 2.0 with respect to paths you removed.
Paths like 'MyProject.Tests/AssertExtensions.cs' that are
removed from your working tree are ignored with this version of Git.
* 'git add --ignore-removal <pathspec>', which is the current default,
ignores paths you removed from your working tree.
* 'git add --all <pathspec>' will let you also record the removals.
Run 'git status' to check the paths you removed from your working tree.
D:\MyProject [master +0 ~1 -0 | +0 ~0 -1]>
但是,运行git add --all .
给出了预期的结果。
这可能是什么原因造成的,我该如何解决?
(我在 Windows 上使用msysgit和posh-git)
更新:如果我将别名重命名为stg
,它工作正常!!我刚刚意识到Git中已经有一个命令,它是...的同义词,所以我无法覆盖它。stage
add