Skip to main content

Posts

Showing posts with the label git

What to do after .gitignore file updated?

After creating a  .gitignore  file in your repository and setting patterns to match files which you do not want Git to track, Git starts tracking repository files and respecting the patterns set in the  .gitignore  file after you run the  git add  command (For example  git add . ). The problem is that if we later make some changes to the  .gitignore  file and then just run the  git add  command again, the changes made in the  .gitignore  file  will not take effect . For example if you later set in the  .gitignore  file that you want Git to start tracking a file which you previously set to be ignored, the file will still be untracked if you just run the  git add .  command. This is because, the  git cache  needs to be cleared. I usually just do this with the  git rm -r --cached .  then after I run the  git add .  command to apply the  .gitignore  changes. Things to note to do when making changes to .gitignore file Here are just some points to note when making changes to the  .gitgnore