DEV Community ๐Ÿ‘ฉโ€๐Ÿ’ป๐Ÿ‘จโ€๐Ÿ’ป

DEV Community ๐Ÿ‘ฉโ€๐Ÿ’ป๐Ÿ‘จโ€๐Ÿ’ป is a community of 970,177 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

Create account Log in
Mahmudul Haque
Mahmudul Haque

Posted on • Updated on

Global gitignore

...

# IDE
.idea/
.vscode/

# OS
DS_Store
.Trash-*

...
Enter fullscreen mode Exit fullscreen mode

The above example of a project's .gitignore file is not a good idea as these ignores are not related to our project rather tied to our environments. GitHub's gitignore repository listed 50+ non project specific gitignore in global directory. Including all of these in a project does not make any sense. As the directory name suggested these are global gitignore. We have to ignore these files globally and not surprisingly git has a concept called global gitignore.

To ignore something globally the first step is to create a .gitignore file in our home directory or any other directory and then let git know the location of the file.

touch ~/.gitignore

git config --global core.excludesfile ~/.gitignore
Enter fullscreen mode Exit fullscreen mode

Copy your necessary global gitignore templates from the repository below and dump them in your global gitignore file.

Global .gitignore templates: https://github.com/github/gitignore/tree/master/Global

Top comments (0)

๐ŸŒš Friends don't let friends browse without dark mode.

Sorry, it's true.