Is there an opposite to git add -p
? Sometimes I add a chunk by mistake and want to remove it from the index (which I do by git reset; git add -p
and adding all the good chunks again). An git remove-from-index -p
command would be helpful in this case.
You can use git rm --cached file to remove the index copy of any file without touching the work-tree copy of that file. So if . idea/somefile is in the index right now, you can remove it with git rm --cached . idea/somefile .
@uvuv - no, you cannot. git does not keep track of files, it keeps track of changes.
The “git reset” command can be seen as the opposite of the “git add” command, essentially adding files to the Git index. When specifying the “–soft” option, Git is instructed not to modify the files in the working directory or in the index at all.
From the git-reset man page:
This means that git reset -p is the opposite of git add -p
^ | exact match of your post title
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With