rramos.github.io

21 Feb, 2021 - About 32 seconds

Git Untrack Previous Committed Files

Intro

This is something that sometimes bugs me, you keep hitting the .gitinore configuration file but still the file you try to ignore always gets referenced on your changes.

If that happens most probably you’ve reference it in the past to be track and you need to remove it, so this are the steps.

Update your .gitignore and untrack the file

This example to untrack db.json

  1. Change the entry in .gitignore ex: *.json

  2. Execute the following command to untrack

git update-index --assume-unchanged db.json
  1. Commit the changes
OLDER > < NEWER