仅添加未跟踪文件 [英] Adding Only Untracked Files
问题描述
我在Git中发现的其中一个非常有用的命令是 git add -u
,以将所有未处理的文件都放入索引中。有没有反过来?在过去的几个月中,我经常发现自己处于一种交互式添加索引更新的位置,我想在提交之前将所有未跟踪的文件添加到该索引。
有没有一种方法可以只将未跟踪的文件添加到索引而不单独标识它们?我在帮助文档中没有看到任何明显的内容,但也许我错过了它?
谢谢。
使用 git add -i
很容易。键入 a
(用于添加未跟踪),然后 *
(用于全部),然后 q
(退出)并完成。
使用单个命令执行操作: echo -ea \\\
* \\\
q\\\
| git add -i
One of the commands I find incredibly useful in Git is git add -u
to throw everything but untracked files into the index. Is there an inverse of that? In the last few months, I've often found myself in a position where I've interactively added some updates to the index and I want to add all of the untracked files to that index before I commit.
Is there a way to add only the untracked files to the index without identifying them individually? I don't see anything obvious in the help docs, but maybe I'm missing it?
Thanks.
It's easy with git add -i
. Type a
(for "add untracked"), then *
(for "all"), then q
(to quit) and you're done.
To do it with a single command: echo -e "a\n*\nq\n"|git add -i
这篇关于仅添加未跟踪文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!