简单的问题。如何将当前目录中修改和跟踪的文件添加到存储库?
假设我有 3 个修改过的文件。
Utils/readme.txt
code/main.pas
code/feature.pas
当前目录在 code/. 所以我只想提交 main.pas 和 feature.pas 文件。
简单的问题。如何将当前目录中修改和跟踪的文件添加到存储库?
假设我有 3 个修改过的文件。
Utils/readme.txt
code/main.pas
code/feature.pas
当前目录在 code/. 所以我只想提交 main.pas 和 feature.pas 文件。
You could do:
git add -u /path/to/folder
However, that will add files in subdirectories of that folder as well, which might not be what you want. If you don't want subdirectories and you are in a bash shell, you can try:
git add /path/to/folder/*.*
That command will add any file in a folder as long as those files follow the standard name.extension naming convention.
仅提交已跟踪的文件:
git add -u
这也将获取任何已删除的文件,但不会添加新创建的文件。