dakni.eu

25 Jan 2019

In case of... (useful git snippets)

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…

  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 (https://stackoverflow.com/a/19095988/3459537)

Tags: git