Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Opposite of git add -p

Tags:

git

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.

like image 962
Micha Wiedenmann Avatar asked Oct 25 '12 09:10

Micha Wiedenmann


People also ask

How do I undo a git add force?

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 .

Can I skip git add?

@uvuv - no, you cannot. git does not keep track of files, it keeps track of changes.

What is the opposite of git commit?

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.


1 Answers

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 
like image 102
greg0ire Avatar answered Sep 29 '22 13:09

greg0ire