Remove single file from a commit

1. Undo the last patch, without scrapping the changes:

-> $ git reset --soft HEAD^

2. Then reset the unwanted files in order to leave them out from the commit:

-> $ git reset HEAD path/to/unwanted_file

3. Now commit again, you can even re-use the same commit message:

-> $ git commit -c ORIG_HEAD

reference: http://stackoverflow.com/questions/12481639/remove-files-from-git-commit

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s