Today I started writing a simple app for fun and decided I want it in source control.
git init later I wanted to split what was so far written into more than one commit.
git add -p however said “no changes”.
After some trials and no successes, I turned to manual for add subcommand, and yes, there it was:
Interactively choose hunks of patch between the index and the work
tree and add them to the index. This gives the user a chance to
review the difference before adding modified contents to the index.
BETWEEN THE INDEX and the work tree… so, without index, I’m doomed. That means, I can’t use
add interactive on an untracked file.
Well, that’s that. For those who think now “just run
git add -i“, it’s the same. Next paragraph in the manual states:
This effectively runs add –interactive, but bypasses the initial
command menu and directly jumps to the patch subcommand. See
“Interactive mode” for details.
Finally, if you think that interactive adding has option to add untracked files, that is true, but it adds them in their entirety.
So, no cookie, time for manual edits. 🙂