DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
Building Scalable Real-Time Apps with AstraDB and Vaadin
Register Now

Trending

  • 4 Expert Tips for High Availability and Disaster Recovery of Your Cloud Deployment
  • Building the World's Most Resilient To-Do List Application With Node.js, K8s, and Distributed SQL
  • The Role of AI and Programming in the Gaming Industry: A Look Beyond the Tables
  • What Is Envoy Proxy?

Trending

  • 4 Expert Tips for High Availability and Disaster Recovery of Your Cloud Deployment
  • Building the World's Most Resilient To-Do List Application With Node.js, K8s, and Distributed SQL
  • The Role of AI and Programming in the Gaming Industry: A Look Beyond the Tables
  • What Is Envoy Proxy?

How to Create a Global .gitignore File

Alec Noller user avatar by
Alec Noller
·
Dec. 03, 14 · Interview
Like (1)
Save
Tweet
Share
2.74K Views

Join the DZone community and get the full member experience.

Join For Free

GitHub encourages you to include a .gitignore file with all of your repositories to specify which files should not be tracked. If you're not looking for it, though, you may not be aware that you can create a global .gitgnore, which will keep certain files or file types from being tracked in any of your projects (in addition to whatever project-specific rules you include in individual .gitignore files). It's useful for things like .DS_Store on OSX (which keeps track of your folder settings) that you'll probably never want to include in any project.

First, create a .gitignore file that you'll use for all of your projects - you'll probably want to put it in your root directory. In their instructions, GitHub suggests:

~/.gitignore_global 

Then, in the terminal, use this command to designate the .gitignore you created as global:

git config --global core.excludesfile ~/.gitignore_global

Keep in mind that the command above assumes you named it .gitignore_global.

If you're not sure what you'd want to exclude, octocat has provided a list of common exclusions that might give you some ideas. You don't want to get too trigger-happy with global exclusions, though - stick to things you're fairly certain you'll always want left out, or else you might forget something relevant down the line. The OS generated files octocat mentions are particularly likely choices:

.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db 
Once you've run the command and added your exclusions, the files and file types you specified won't be tracked in any of your Git repos!

Opinions expressed by DZone contributors are their own.

Trending

  • 4 Expert Tips for High Availability and Disaster Recovery of Your Cloud Deployment
  • Building the World's Most Resilient To-Do List Application With Node.js, K8s, and Distributed SQL
  • The Role of AI and Programming in the Gaming Industry: A Look Beyond the Tables
  • What Is Envoy Proxy?

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com

Let's be friends: