DEV Community 👩‍💻👨‍💻

Cover image for Save time using global .gitignore
Dany Paredes
Dany Paredes

Posted on • Updated on

Save time using global .gitignore

Sometimes we are ignoring the same files for every projects like .DS_Store or npm-debug.log*,we can save time using a global .gitignore.

Note: Be Keep in mind, that it will change your default behavior in your computer. If you shared project be careful which directories you set into it for example if you add >node_modules/ then you can't add or .vscode.

These steps works in Linux and Mac.

1- Create gitignore in the root path.

touch ~/.gitignore
Enter fullscreen mode Exit fullscreen mode

Edit the .gitignore and include these files you always need to ignore.

.nyc_output
.DS_Store
npm-debug.log*
Enter fullscreen mode Exit fullscreen mode

From terminal configure git where the gitignore file is located.

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

Done!!!

Photo by Lukas Blazek on Unsplash

Top comments (0)

DEV

Thank you.

 
Thanks for visiting DEV, we’ve worked really hard to cultivate this great community and would love to have you join us. If you’d like to create an account, you can sign up here.