# 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