0
Q:

how to git ignore a file

# creates gitignore file
$ touch .gitignore
6
You can ignore entire directories, just by including their paths and putting a / on the end:

1
2
node_modules/
logs/
4
$ echo debug.log >> .gitignore
$ git rm --cached debug.log
rm 'debug.log'
$ git commit -m "Start ignoring debug.log"
5
git rm -rf --cached .
git add .
0
git config --global core.excludesfile ~/.gitignore_global
0
echo "
bin/**
lib/**
pyvenv.cfg
**.pyc
"  > .gitignore
cat .gitignore
1

New to Communities?

Join the community