dakni.eu

14 Jul 2019

Stop tracking of already tracked files

Why? One scenario: you write on a paper using LaTeX, compile the document, git add ., git commit -m "created pdf", git push, and then you recognize that all the files you are not interested in, i.e. basically all besides the .tex file are tracked…

First make sure to commit all changes in the repository to not accidentally lose any work.

  1. put them in .gitignore
  2. recursively clean the index

    git rm -r --cached . 
    
  3. rebuild index

    git add .
    
  4. commit your changes

    git commit -am "Remove ignored files"
    

Of course, I had help in finding this. Thanks Matt Frear

Tags: git