Of course, the workaround there is that one adds the initial file into the staging area and then `git add -p` the subsequent changes. It could just be a bit more convenient on that front, is all.
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.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--...>
git add file
git reset -p fileIn d u, you can “s” on a file or hunk and it’ll stage just that. And if you select lines (c-spc?) it’ll stage just those lines.
To unstage, go to d s and use “u” the same way.
The massive advantage aside from line-wise staging is that you don’t need to stage linearly.
git checkout -p -- .Git rebase -i HEAD~[number of commits]