# if you want to just remove from latest commit
git rm -r --cached <file/dir>
# if you want to remove from all commit history
git filter-branch --index-filter 'git rm -r --cached --ignore-unmatch <file/dir>' HEAD
git rm —-cached <file-to-remove>
git commit —-amend
git reset --soft HEAD^
or
git reset --soft HEAD~1
git reset HEAD path/to/unwanted_file
git commit -c ORIG_HEAD
git reset --soft HEAD^
git reset HEAD path/to/unwanted_file
git commit -c ORIG_HEAD
$ git rm --cached <file>