DEV Community

Cover image for Some many ways to ignore file changes in Git

Posted on

Some many ways to ignore file changes in Git

When you are working with your team, sometimes you need to ignore files. If a change that involve all the team, you can add the ignored file to the .gitignore file of your repo.

This way you have to save a new commit and all the team have to pull the changes, but you can use three more ways.

One of them is creating a .gitignore.local, but you also have to add it to the .gitignore and creating a new commit.

If you are nos interested in save a commit, you can ignore files locally, saving the ignored file in the global git configuration:

git config --global core.excludesfile ignored_file

...or you can use a file created in your git repository called .git/info/exclude. This file is basically a gitignore but the changes in it are not reflected in the stash.

Top comments (0)