简体   繁体   中英

Unstage committed changes but keep new files in index

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 (ie git add -N ).

After reading the doc more attentively, I found the answer.

This does exactly what I want: git reset --mixed -N HEAD~1

也许我不太了解,但是不是那个git reset --soft

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM