gitgit-add

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?

Such as a way to add only the untracked files to the index without identifying them individually?


Solution

  • 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