Git ignore vs Git exclude

If you are a developer you might have used git to manage your source repository. Then you might use .gitignore file to exclude files or folders that you don’t want to sync with your remote repository.

.gitignore

If you specifies files or folders in .gitignore file, you can exclude files or folders messed up by an unexpected situation. Because it syncs with your remote repository which means all your team members share this configuration for a project.

exclude

git ls-files --others --exclude-from=.git/info/exclude

When I work on a React Native project then I need to be careful not to affect Android sources. In this case exclude file could be a solution for you. The scope of exclude file is for your machine which means that you exclude folders or files in your machine not to sync with the remote repositories.

Leave a Reply