diff --git a/README.md b/README.md index 1e3b80d..14be7ea 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ pairing with smart people at Hashrocket. For a steady stream of TILs, [sign up for my newsletter](https://tinyletter.com/jbranchaud). -_996 TILs and counting..._ +_997 TILs and counting..._ --- @@ -221,6 +221,7 @@ _996 TILs and counting..._ - [Clean Out All Local Branches](git/clean-out-all-local-branches.md) - [Clean Up Old Remote Tracking References](git/clean-up-old-remote-tracking-references.md) - [Clone A Repo Locally From .git](git/clone-a-repo-locally-from-git.md) +- [Configure Global gitignore File](git/configure-global-gitignore-file.md) - [Configuring The Pager](git/configuring-the-pager.md) - [Delete All Untracked Files](git/delete-all-untracked-files.md) - [Determine The Hash Id For A Blob](git/determine-the-hash-id-for-a-blob.md) diff --git a/git/configure-global-gitignore-file.md b/git/configure-global-gitignore-file.md new file mode 100644 index 0000000..0949f15 --- /dev/null +++ b/git/configure-global-gitignore-file.md @@ -0,0 +1,33 @@ +# Configure Global gitignore File + +There are some files that you know you'll never want tracked by git. You don't +even want them showing up as an option. For these files, it can be nice to +specify them in a global `.gitignore` file. Then you don't need to specify them +for each project. + +This can be configured in `~/.gitconfig` under the `core` settings as +`excludesFile`. + +``` +[core] + excludesFile = ~/.gitignore +``` + +Then, create `~/.gitignore` (that's as good a place as any to put it). + +``` +# global .gitignore +.DS_Store +wip_notes.md +``` + +You'll now notice that for any git project, the files you listed won't be +showing up in the untracked list. + +You can also add this to your `~/.gitconfig` with this one-line command. + +```bash +$ git config --global core.excludesfile ~/.gitignore +``` + +See `man git-config` and search `core.excludesFile` for more details.