Whoa, all that update-index
and hash-object
business seems overly complicated. How about this instead:
git add -N new_file
git add -i # or 'git add -p' if you prefer
From git help add
:
-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.