git stop tracking files matching pattern 1

git stop tracking files matching pattern

# Update your .gitignore file – for instance, add a folder you don't want to track to .gitignore.

git rm -r --cached . # Remove all tracked files, including wanted and unwanted. Your code will be safe as long as you have saved locally.

git add . # All files will be added back in, except those in .gitignore.

Here is what the above code is Doing:
1. git rm -r –cached . removes all files from the index.
2. git add . adds all files, except those in .gitignore, back to the index.

Similar Posts