Git add all files modified, deleted, and untracked?
Is there a way to add all files no matter what you do to them whether it be deleted, untracked, etc? like for a commit. I just don't want to have to git add
or git rm
all my files every time I commit, especially when I'm working on a large product.
Try:
git add -A
Warning: Starting with git 2.0 (mid 2013), this will always stage files on the whole working tree .
If you want to stage files under the current path of your working tree, you need to use:
git add -A .
Also see: Difference of git add -A
and git add .
Try
git add -u
The " u
" option stands for update. This will update the repo and actually delete files from the repo that you have deleted in your local copy.
git add -u [filename]
to stage a delete to just one file. Once pushed, the file will no longer be in the repo.
Alternatively,
git add -A .
is equivalent to
git add .
git add -u .
Note the extra '.' on git add -A
and git add -u
Warning: Starting with git 2.0 (mid 2013), this will always stage files on the whole working tree .
If you want to stage files under the current path of your working tree, you need to use:
git add -A .
Also see: Difference of git add -A
and git add .
You want git add -A
:
git add -A
stages All;
git add .
stages new and modified, without deleted;
git add -u
stages modified and deleted, without new.
上一篇: 仅添加未跟踪文件
下一篇: Git添加修改,删除和未跟踪的所有文件?