1
0
mirror of https://github.com/jbranchaud/til synced 2026-01-02 22:58:01 +00:00

Add Configure Global gitignore File as a git til

This commit is contained in:
jbranchaud
2021-01-06 19:36:07 -06:00
parent ebe8b38a93
commit af56ab2ce6
2 changed files with 35 additions and 1 deletions

View File

@@ -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)

View File

@@ -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.