PASSWORD RESET

Your destination for complete Tech news

How to clear git local cache

5.66K 0
< 1 min read

There are certain situations when you unknowingly add files to git and you try to remove those files later on by adding the names to .gitignore. Even though you add the name of the files in .gitignore, git will continue to track those files even if they were added to the .gitignore later on.

To remove the files/folders from git staging area, you can simply use the following code inside the terminal

git rm --cached file_name

If you are unsure about the filenames, you can use the following lines to do everything up to date.

git rm -r —cached .

After doing those changes, don’t forget to commit the changes otherwise git will not stop tracking those files even if you add those names to the .gitignore later on.

Leave A Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.