默认情况下,如果我使用 git add
,它会直接将文件添加到暂存区。
我想要它,仅将其添加到未暂存区域。怎么做?
最佳答案
您可能正在寻找 --intent-to-add
选项:
-N, --intent-to-add
Record only the fact that the path will be added later. An entry for the path is placed in the index with no content. This is useful for, among other things, showing the unstaged content of such files with git diff and committing them with git commit
-a
.
这会将文件作为空文件添加到索引中,这将使 git diff
将其所有内容显示为“已添加”。
关于git - 将未跟踪文件添加到 GIT 中的未暂存区域,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46736046/