Remove unwanted files from Git commit

Recently i came across the situation where i committed the unwanted files and would like to remove them from the commit and found the following help from google.

First step is to do git reset the HEAD using the following command

git reset --soft ^HEAD or git reset --soft HEAD~1

Next step is to remove unwanted files fro the commit

git reset HEAD /path/to/unwanted file

Then commit again as follows. It would probably open the editor inorder to change the commit message or you can use the same commit message.

git commit -c ORIG_HEAD

Hope this is helpful.



Comments

Popular posts from this blog

Bash - Execute Pl/Sql script from Shell script

How to get client Ip Address using Java HttpServletRequest

How to install Portable JDK in Windows without Admin rights