{{announcement.body}}
{{announcement.title}}

Global gitignore [Code Snippet]

DZone 's Guide to

Global gitignore [Code Snippet]

Learn more about global gitignore, a widely used Git feature that allows files to be ignored within the Git repository.

· Open Source Zone ·
Free Resource

Let's learn more about global gitignore, a widely used Git feature that allows files to be ignored within the Git repository.

Global gitignore

A widely used Git feature is to use local .gitignore files which list which names and patterns of files and directories will be ignored within the Git repository.

There is also the possibility to create a system-wide gitignore file, which lists patterns that should always be ignored in all of the user's Git repositories.

You may also like: When .gitignore Stops Being Your Friend

You can point to the file in your Git config via git config --global core.excludesfile ~/.gitignore_global.

The following ~/.gitignore_global file will cause .java-version files to always be ignored within your Git setup:

Shell




x


 
1
# jenv
2
.java-version



Also, have a look at the GitHub documentation.

The content of this post was reposted from my newsletter issue 028All opinions are my own and do not reflect those of my employer or colleagues.

Further Reading

When .gitignore Stops Being Your Friend

Beyond Beginning Git: Exclude and Interactive Add

Tutorial: Git With Eclipse

Topics:
open source ,git ,repo ,ignore ,gitignore ,files ,code snippet

Published at DZone with permission of Sebastian Daschner , DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}