Skip to content

Instantly share code, notes, and snippets.

@SiddharthShringi
Last active December 23, 2020 19:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SiddharthShringi/66d11c27229e919020058163c907e58d to your computer and use it in GitHub Desktop.
Save SiddharthShringi/66d11c27229e919020058163c907e58d to your computer and use it in GitHub Desktop.

How to update .gitignore file so that git actually starts tracking right files.

When we make changes to the .gitignore file, those changes will not take effect just by updating the .gitignore file content. Git will still be tracking files according to previous content of gitignore file.

To make it work we have to clear the git cache. Here are the steps that we can follow to successfully telling git to track right files.

  • Make changes in .gitignore file.
  • Run git rm -r --cached . command.
  • Run git add . command

Now Run the command git status to check whether new changes in gitignore are working or not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment