Categories
Workflow

Remove Files from Git Repo

From: https://medium.com/better-programming/how-to-remove-committed-files-from-git-version-control-b6533b8f9044


  1. Create a .gitignore file, if you haven’t already
  2. Edit .gitignore to match the file/folder you want to ignore
  3. Execute the following command: 
    git rm --cached path/to/file
  4. Git will list the files it has deleted. The --cached flag should be used if you want to keep the local copy but remove it from the repository.
  5. Verify that these files are being deleted from version control using git status
  6. Push the changes to the repository

After completing these steps, those files should be removed from version control but not removed from any local machine. Any other developer which pulls again after you pushed your changes should have no issues.

How To Remove Committed Files From Git Version Control