remove ignored files from git repository

I ran into a situation today, whereby I had created a git reposiotry for a new MVC web application I am developing. I had created a git repository and only after a couple of days of development had I realised I need to include a few more file extensions to my .gitignore file.

There were a whole host of files that I need to configure git to ignore, but unfortunately these files were already in my local git repository and had already been synced to my GitHub repository. I needed to be able to remove ignored files from git repository.

I updated my .gitignore file with all the additional extensions

The downside is that adding new extensions to your .gitignore file will not enforce a retrospective action to remove these files on your next commit 🙂

What I needed to do in my case was execute the following commands using the Git Bash :

Once this was complete I had to then re-synchronize with the Github repository.


Gary Woodfine

Freelance Full Stack Developer at
Helps businesses by improving their technical proficiencies and eliminating waste from the software development pipelines.

A unique background as business owner, marketing, software development and business development ensures that he can offer the optimum business consultancy services across a wide spectrum of business challenges.