However, will it automatically remove these committed files from the repository?
No.
The 'best' recipe to do this is using git filter-branch
as written about here:
The man page for git-filter-branch contains comprehensive examples.
Note You'll be re-writing history. If you had published any revisions containing the accidentally added files, this could create trouble for users of those public branches. Inform them, or perhaps think about how badly you need to remove the files.
Note In the presence of tags, always use the --tag-name-filter cat
option to git filter-branch
. It never hurts and will save you the head-ache when you realize later taht you needed it