How to make Git “add --all” by default?

半城伤御伤魂 提交于 2019-12-03 05:52:28

The warning you see comes from commit ccc663b, itself reworking commit 45c45e3.

That second commit does include:

git add: start preparing for "git add <pathspec>..." to default to "-A"

Plan to eventually make "git add" pretend as if "-A" is given when there is a pathspec on the command line.
When resolving a conflict to remove a path, the current code tells you to "git rm $path", but with such a change, you will be able to say "git add $path" (of course you can do "git add -A $path" today).

So with Git 2.0, git add . will do what you want, but right now, a git alias is the way to get this by default.

git config alias.a 'add -A .'

[alias] 
  a = add -A .

This is now (March 2014) registered for the next release, with commit 160c4b1 and commit fdc97ab, for the next Git 2.0 (Q2 2014).

Nancy

With git you can create aliases, so you can try this:

git config --global alias.adall 'add . --all'

Here use "adall" but not "add" to avoid some unnecessary add but if you like add is also OK.

After this configuration then you can add all by command like below:

git adall
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!