Refreshing Git versioned files

source tree git

Occasionally you would need to add new files to .gitignore. If you have Git already initialised, Git will not forget the files even if you add a new rule to your git ignore. To do this, go to your local repo.

> touch .gitignore

Edit the file.. such as adding the following rules. These rules will ignore all the files with .toc, .tex.bak ….. in all the directories.

/*.synctex.gz
/*.tex.bak
/*.toc

The remove all the tracked files. Do not worry as this will only update the git index and will not delete the actual files.

> git rm -r –cached .
> git add .

And you are done.