Setting up a global .gitignore on a Mac
I work with multiple OSes, programming languages and frameworks so here is a tip on keeping your git repos clean. I create a global .gitignore file to exclude platform related files (OS and IDE) and then when I create a new project I create a project specific .gitignore for the project related files which is specific to the languages and frameworks I am using in the project.
You may name the file and place it where you want. I typically just name it .gitignore and store at '~/.gitignore'.
Set it by running the following in a terminal:
Here is my global which I place at '~/.gitignore'
GitHub have created a repo as a guide for what to include in your .gitignore for specific languages and frameworks: https://github.com/github/gitignore.
Creating a global gitignore on a Mac
You may name the file and place it where you want. I typically just name it .gitignore and store at '~/.gitignore'.
Set it by running the following in a terminal:
git config --global core.excludesfile '~/.gitignore'
Example global gitignore
Here is my global which I place at '~/.gitignore'
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# OS generated files # | |
###################### | |
.DS_Store | |
.DS_Store? | |
._* | |
.Spotlight-V100 | |
.Trashes | |
ehthumbs.db | |
Thumbs.db |
Project specific gitignore
GitHub have created a repo as a guide for what to include in your .gitignore for specific languages and frameworks: https://github.com/github/gitignore.
Comments