$0.28

Remove files from Git commit

Ask a question+
2

I am using Git and I have committed few files using

git commit -a

Later, I found that a file had mistakenly been added to the commit.
How can I remove a file from the last commit?

add comment

1 Answer

1

git reset —soft HEAD^
or
Then reset the unwanted files in order to leave them out from the commit:

git reset HEAD path/to/unwanted_file

nandhini 55
add comment

Your Answer