If you accidentally commit an unwanted file to the git scratchpad, you can delete the file from the scratch area with the git rm command. For example, if you accidentally submit a file called: test.js you can execute a command:

1
git rm --cache test.js

If you want to delete a directory, you need to add the -r parameter. For example, to delete a directory named : target, this can be done:

1
git rm -r --cache target
TAGS