I'm still relatively new to Git, so perhaps I'm doing something stupid, but I have a weird issue...
I defined a stage
alias for add --all
, because I find it shorter and more self-explanatory:
D:\MyProject [master +0 ~1 -1]> git config alias.stage "add --all"
D:\MyProject [master +0 ~1 -1]> git config alias.stage
add --all
But when I run git stage .
, it behaves as if the --all
option was omitted:
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]>
However, running git add --all .
gives the expected result.
What could be causing this, and how can I fix it?
(I'm using msysgit and posh-git on Windows)
UPDATE: if I rename the alias to stg
, it works fine!! I just realized that there is already a stage
command in Git, and it's a synonym for add
... so I can't override it.
Git already has a built-in stage
command, and it's a synonym for add
... And apparently it's not possible to override a built-in command with an alias. If I rename the alias to stg
, it works fine.