This is not the same as Remove files from Git commit, because all the answers there doesn't work for this case. So here is the question,
Before git commit
, we use git add
. The problem is when we are doing git add
, sometimes we forgot to check and only when doing git commit
did we realized that those files should not be picked up by git add
are being added and committed.
This is the reason why all the answers there doesn't work, because git reset HEAD^
or alike does not work for files newly being picked up, and have not git history beforehand. I learned it the hard way.
So, any solution for this case? Thx.