Two Git ignore files nobody told me about
mihai.dinculescu.dev
mihai.dinculescu.dev
Also `~/.gitignore` works as a global gitignore. I usually stick something like `katie*` in there so I can copy some `script.sh` to `katie_script.sh` and then I can make changes that I don't want to commit.
Quick edit: I'm not sure `~/.gitignore` works out of the box.. looks like I stuck that in my `~/.gitconfig` for excludesfile
.git/exclude
--assume-unchanged
--no-update-index
.And fwiw, I think global/home-dir .gitignore is bad, for everything except of OS-level spam like .DS-Store
I have dependency_tree globally excluded because it is my unique naming convention. Actually it might just be my unique approach because other people don't seem to mind having 1000 overrides for libraries they don't use.
My preference of not having much in my global gitignore is only sensible for my particular daily work, if you need to partially track build folders in projects and can't control the ignore files automatically, a global ignore might make sense.
"Do the reading b/c you would be amazed how many people don't do the reading"
Reading documentation is a superpower
Now that you mention it, I should add a link to those docs in the article. Thanks!
For example, with direnv, the `.envrc` in my projects usually has
source_env_if_exists .envrc.local
And the repo also ships with a `.envrc.local.example` file.> Some configs don't allow extending
Pick a directory for them and ignore the directory. Other team members who want to keep their own notes can use that directory as well.
I couldn't agree more with this - except that, in practice, nobody bothers to add their own environment clutter to their own global (or even project-related) gitignore. So invariably we end up with PRs (and even main :scream:) peppered with various .vscode and similar lost souls.
The other useful advice is when there is a full folder you want to ignore. Putting a .gitignore with a single "*" ignores the full folder...including the gitignore file itself.
I do use it when I quickly need to ignore the .idea folder
The more useful thing here is the "typical use" of each one. People who don't know about other methods get this wrong a lot and put cruft from their own tools/editors in .gitignore which is annoying.
You can use this subcommand to learn which ignore file is causing your files to be ignored.
I run the same presubmits on pre-receive and merge requests, so you wouldn't get too far shooting your own foot. But yeah, if you're not using the feature then it wouldn't save you so it's not foolproof. I also run tools for scanning for credentials, etc.
I’ve used pre-commit hooks for this but I’d rather a simple config flag, it seems trivial.
I've been leaving notes sitting untracked rather than put a filename only I use into the repo. .git/info/exclude is what I actually needed.
Beyond things not being neatly compartmentalized, what is the problem? The only risk I see is that you'll have a file you forgot to commit because it happened to match one of those patterns.
Having strong opinions on stuff like this is not healthy.