When I tried git add -p someNewFile.txt in a new file (file without a trace), git would simply git add -p someNewFile.txt No changes. and stopped. I had to tell git that I intended to track the new file first.
git add -N someNewFile.txt git add -p
However, since the file has not been verified, it will appear as one giant piece that cannot be broken (because it is all new!). So, I needed to edit the piece into smaller bits. If you are not familiar with this, check out this link to get started.
Update - Hunk Editing Information I would like to update this if the above link disappears. Since the new file is not tracked, git add -p will display each line in the file as a new line in one column. He will then ask you what you want to do with this hunk by providing you with the following prompt:
Stage this hunk [y,n,q,a,d,/,e,?]?
Assuming you don't want to commit the entire hunk (and therefore the whole file, because I'm not sure why you would like to use git add -p in this case?), You need to specify the e option to tell git that you want to edit hunk.
After you tell git that you want to edit the piece, it should drop you into your editor so that you can make your changes. All lines must have the + prefix, and git contains some explanatory comments (with the # prefix) at the end of the file. Just delete any lines you don't want in your original file commit. Then save and close the editor.
Git explanation of git hunk options:
y - stage this hunk n - do not stage this hunk q - quit; do not stage this hunk or any of the remaining ones a - stage this hunk and all later hunks in the file d - do not stage this hunk or any of the later hunks in the file g - select a hunk to go to / - search for a hunk matching the given regex j - leave this hunk undecided, see next undecided hunk J - leave this hunk undecided, see next hunk k - leave this hunk undecided, see previous undecided hunk K - leave this hunk undecided, see previous hunk s - split the current hunk into smaller hunks e - manually edit the current hunk ? - print help