3 ms·
It can, you just gotta do a magic incantation first. git add -N file git add -p file The first command signals to git that you intend to add the file. Tha
by matheusmoreira 2y ago
It can, you just gotta do a magic incantation first.
git add -N file
git add -p file
The first command signals to git that you intend to add the file. That makes its entire content show up in the patch editor.
- sham1 2y agoTIL! I seem to have just missed the `-N`/`--intend-to-add` while perusing through the `git-add(1)` manual. Heh, it[0] even notes a similar use case: > `-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`. [0]: <https://git-scm.com/docs/git-add#Documentation/git-add.txt--N https://git-scm.com/docs/git-add#Documentation/git-add.txt--...>