Rob Wilkerson Rob Wilkerson - 1 month ago 4
Git Question

Adding Only Untracked Files

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.

Mat Mat
Answer

It's easy with git add -i. Type a (for "add untracked"), then * (for "all"), then q (to quit) and you're done.