Oftentimes, when using git, I find myself in this situation:
- I have changes to several files, but I only want to commit parts of them.
- I have added several untracked files, which I want to track and commit.
Solving the first part is easy; I run:
git add -p
Then, I choose which hunks to stage, and which hunks remain in my working tree, but unstaged. However, git's patch mode skips over untracked files.
What I would like to do is something like:
git add --untracked
But no such option appears to exist.
If I have, say, six untracked files, I could stage them using add
in interactive mode and the add untracked
option, like so:
git add -i
a<CR>
1<CR>
2<CR>
3<CR>
4<CR>
5<CR>
6<CR>
<CR>
q<CR>
I feel like there is, or should be, a quicker way of doing this, though. What am I missing?