git ignore folder visual code code example

Example 1: git ignore .idea folder

Git never ignores changes to tracked files. As it appears as modified, the file 
is under version control (the idea/workspace.xml file usually should not be) 
and thus changes to it are tracked. Delete it from the index, leaving your 
local copy intact with

git rm --cached .idea/workspace.xml 

and commit this change. From then on it will be ignored unless you force-add it 
back to the repository or change your gitignore settings.

# Remove the file from the repository
git rm --cached .idea/

# now update your gitignore file to ignore this folder
.idea/

# add the .gitignore file
git add .gitignore

git commit -m "Removed .idea files"
git push origin 

Example 2: how to use gitignore to ignore a folder

You can ignore entire directories, just by including their paths and putting a / on the end:

1
2
node_modules/
logs/

Tags:

Misc Example