Reputation: 1225
I want to split the last commit in two, so I use git reset HEAD~1
, but then it loses track of the new files that were added by the commit (which were not tracked before), and I have to carefully add them back one by one. I often have other untracked files lying around waiting to be committed later, so this is annoying.
What I would like is a way to reset
but keep the files added by the commit as empty, as if they had been added with git add --intent-to-add
(i.e. git add -N
).
Upvotes: 5
Views: 1351
Reputation: 643
Maybe I didn't understand very well, but isn't that a git reset --soft
?
Upvotes: 2
Reputation: 1225
After reading the doc more attentively, I found the answer.
This does exactly what I want: git reset --mixed -N HEAD~1
Upvotes: 4