Tidbit: git-add –patch on a new file.Posted: June 8, 2010
Today, I wanted to add a file to the git index interactively.
$ echo blah > somefile $ git-add --patch somefile fatal: exec add--interactive failed.
It turns out there is a problem. Until git knows about the file, it can’t actually diff against it, or go into interactive patch mode. As it turns out, someone has thought ahead.
$ git add -N somefile # adds it!
“-N” is the “–intent-to-add” flag. Whether this is a win or not is left as an exercise for the reader, but it does exist.