Start tracking a file in Git without adding it to the index

git

Solution

Seems like you're looking for `git add --intent-to-add` (or `git add -N`). From the official `git add` documentation:

-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`.

See the What does git add --intent-to-add or -N do and when should it be used? question for more information.

Problem

Is it possible to start tracking files in git without adding them to the index? I have new files which I'd like to survive a `git clean`, but will likely change before the next commit. Do I simply add them to the index now, and then add them again later just before the commit?

Original source

Related problems