Ben*_*ngt 18 git alias git-config
我刚碰到这条消息:
$ git add .
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 'README.md' 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.
Run Code Online (Sandbox Code Playgroud)
我认为设置--all
是一个非常理智的默认设置,因为reset
如果有意外添加的话,我可以.如何将该行为设为默认值?
Von*_*onC 11
您看到的警告来自commit ccc663b,它本身正在重新提交45c45e3.
第二次提交确实包括:
git add
:开始准备" git add <pathspec>...
"默认为" -A
"计划最终使"git add"假装
-A
在命令行上有一个pathspec时给出" ".
在解决冲突以删除路径时,当前代码会告诉您"git rm $path
",但是通过这样的更改,您将能够说"git add $ path"(当然您可以执行"git add -A $ path"今天).
所以使用Git 2.0,git add .
会做你想要的,但是现在,git别名是默认情况下获得此功能的方法.
git config alias.a 'add -A .'
[alias]
a = add -A .
Run Code Online (Sandbox Code Playgroud)
现在(2014年3月)注册了下一个版本,提交160c4b1并提交fdc97ab,用于下一个Git 2.0(2014年第2季度).