gitgitignoregit-addgit-rm

Undo .gitignore changes


I previously ignored a folder, but now I would like to ignore its content only: How do I remove/modify some entries from my .gitignore file so that git will track them again? I tried updating the gitignore file and adding the folder with git add -f <folder-name>, but it didn't work.

Thank you for your help


Solution

  • What do you mean by ignoring its content only, If you want to track an empty directory?

    there is way to make a directory stay (almost) empty (in the repository) is to create a .gitignore file inside that directory that contains these four lines:

    # Ignore everything in this directory
    *
    # Except this file
    !.gitignore