git supports global gitignore files (#tilPost)

Today I found a LinkedIn post from Luciano Mammino, which shared a small but super handy git configuration fact.
Suppose you’re on macOS, you know .DS_Store files. The "Desktop Services Stores" hold the folder’s custom att…


This content originally appeared on Stefan Judis Web Development and was authored by Stefan Judis

Today I found a LinkedIn post from Luciano Mammino, which shared a small but super handy git configuration fact.

Suppose you're on macOS, you know .DS_Store files. The "Desktop Services Stores" hold the folder’s custom attributes, icon positions, and other operating system metadata. These files are useless for web development, though.

And if you're a "YOLO, I commit everything!" person, you probably have checked these files into your version control system. But there's help!

As Luciano shared, with a little bit of git configuration, you can eliminate this problem forever. Run the following command to define .gitignore_global as the core.excludesfile option.

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

This command creates the following setting in your global .gitconfig.

# .gitconfig
[core]
  excludesfile = ~/.gitignore_global

Create a .gitignore_global file, and voila! You'll never have to fear committing DS_Store files again!

# .gitignore_global
.DS_Store

Reply to Stefan


This content originally appeared on Stefan Judis Web Development and was authored by Stefan Judis


Print Share Comment Cite Upload Translate Updates
APA

Stefan Judis | Sciencx (2021-12-18T23:00:00+00:00) git supports global gitignore files (#tilPost). Retrieved from https://www.scien.cx/2021/12/18/git-supports-global-gitignore-files-tilpost/

MLA
" » git supports global gitignore files (#tilPost)." Stefan Judis | Sciencx - Saturday December 18, 2021, https://www.scien.cx/2021/12/18/git-supports-global-gitignore-files-tilpost/
HARVARD
Stefan Judis | Sciencx Saturday December 18, 2021 » git supports global gitignore files (#tilPost)., viewed ,<https://www.scien.cx/2021/12/18/git-supports-global-gitignore-files-tilpost/>
VANCOUVER
Stefan Judis | Sciencx - » git supports global gitignore files (#tilPost). [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/12/18/git-supports-global-gitignore-files-tilpost/
CHICAGO
" » git supports global gitignore files (#tilPost)." Stefan Judis | Sciencx - Accessed . https://www.scien.cx/2021/12/18/git-supports-global-gitignore-files-tilpost/
IEEE
" » git supports global gitignore files (#tilPost)." Stefan Judis | Sciencx [Online]. Available: https://www.scien.cx/2021/12/18/git-supports-global-gitignore-files-tilpost/. [Accessed: ]
rf:citation
» git supports global gitignore files (#tilPost) | Stefan Judis | Sciencx | https://www.scien.cx/2021/12/18/git-supports-global-gitignore-files-tilpost/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.