4 ms·
It's surprisingly hard to unstage a file. Is there a case when it's not a simple git reset my-file away?
by djacobs 15y ago
It's surprisingly hard to unstage a file.
Is there a case when it's not a simple git reset my-file away?
- ajross 15y agoIndeed no. That's exactly what git reset does: "copy entries from <commit> to the index". I got that from the unusably bad man page. It was the first sentence.
- tspiteri 15y agoYes there is. When you have a new repository without any commits, there is no HEAD, so you can't unstage by resetting. mkdir try cd try git init touch file git add file git status Still, the git status command shows you what you need to do to unstage.
- phillmv 15y agoI forget my exact edge case. Something to do with wanting to unstage a folder, or unstaging a folder while wanting to preserve work in some of the files.