Two Git ignore files nobody told me about
Thread
Loading the complete thread in the background. This saved snapshot is available now. Refresh
Unofficial Hacker News client; not affiliated with Y Combinator.
Two Git ignore files nobody told me about
Loading the complete thread in the background. This saved snapshot is available now. Refresh
Unofficial Hacker News client; not affiliated with Y Combinator.
DamonHD · · focus · HN ↗
festive-minsky · · focus · HN ↗
biglyburrito · · focus · HN ↗
6LLvveMx2koXfwn · · focus · HN ↗
alexpotato · · focus · HN ↗
"Do the reading b/c you would be amazed how many people don't do the reading"
bigfishrunning · · focus · HN ↗
Reading documentation is a superpower
faithraven · · focus · HN ↗
1718627440 · · focus · HN ↗
coldpie · · focus · HN ↗
windward · · focus · HN ↗
stephbook · · focus · HN ↗
fortran77 · · focus · HN ↗
faithraven · · focus · HN ↗
Now that you mention it, I should add a link to those docs in the article. Thanks!
onaclov2000 · · focus · HN ↗
gritzko · · focus · HN ↗
BeetleB · · focus · HN ↗
ivyBadger920 · · focus · HN ↗
[dead]
psygn89 · · focus · HN ↗
jo-m · · focus · HN ↗
For example, with direnv, the `.envrc` in my projects usually has
And the repo also ships with a `.envrc.local.example` file.BeetleB · · focus · HN ↗
> Some configs don't allow extending
faithraven · · focus · HN ↗
faithraven · · focus · HN ↗
dpkirchner · · focus · HN ↗
You can use this subcommand to learn which ignore file is causing your files to be ignored.
<a href="https://git-scm.com/docs/git-check-ignore" rel="nofollow">https://git-scm.com/docs/git-check-ignore
faithraven · · focus · HN ↗
globular-toast · · focus · HN ↗
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.
ktm5j · · focus · HN ↗
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
nom · · focus · HN ↗
ktm5j · · focus · HN ↗
spider-mario · · focus · HN ↗
[deleted] · · focus · HN ↗
[deleted]
sinabis · · focus · HN ↗
crtasm · · focus · HN ↗
ktm5j · · focus · HN ↗
crtasm · · focus · HN ↗
[deleted] · · focus · HN ↗
[deleted]
infogulch · · focus · HN ↗
moritzwarhier · · focus · HN ↗
And fwiw, I think global/home-dir .gitignore is bad, for everything except of OS-level spam like .DS-Store
happymellon · · focus · HN ↗
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.
moritzwarhier · · focus · HN ↗
moritzwarhier · · focus · HN ↗
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.
cxr · · focus · HN ↗
[dead]
quietbritishjim · · focus · HN ↗
cxr · · focus · HN ↗
quietbritishjim · · focus · HN ↗
cxr · · focus · HN ↗
askl · · focus · HN ↗
Same way you're currently getting them to not check in .gitignore files. Require them to write working build scripts.
cxr · · focus · HN ↗
Phemist · · focus · HN ↗
Also you can do `git status --ignored` and it will list all files changed, even if ignored. If that is really your main issue.
cxr · · focus · HN ↗
Phemist · · focus · HN ↗
My comment and the other replies show you how to use git to check and clean the files of the much maligned horked build script. These will work regardless of the gitignore contents.
But then again, pretty sure you are just having a laugh at our expense by taking this ridiculous position.
cxr · · focus · HN ↗
No, it doesn't. The ln(1) invocation you wrote is not going to work. As written, it contains two glaring errors obvious on sight to anyone who actually has enough experience with the particulars symlinks and Git's .git/info/exclude.
> My comment and the other replies show you how to use git
Oh, gee, thanks!
Phemist · · focus · HN ↗
cxr · · focus · HN ↗
athorax · · focus · HN ↗
Also:
cxr · · focus · HN ↗
cxr · · focus · HN ↗
Supermancho · · focus · HN ↗
grimgrin · · focus · HN ↗
henrydoughty · · focus · HN ↗
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.
markbnj · · focus · HN ↗
faithraven · · focus · HN ↗
gritzko · · focus · HN ↗
markbnj · · focus · HN ↗
havnagiggle · · focus · HN ↗
etatester · · focus · HN ↗
havnagiggle · · focus · HN ↗
I run the same presubmits on pre-receive and merge requests, so you wouldn't get too far shooting your own foot.
n4bz0r · · focus · HN ↗
BeetleB · · focus · HN ↗
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.
OutOfHere · · focus · HN ↗
tonymet · · focus · HN ↗
I’ve used pre-commit hooks for this but I’d rather a simple config flag, it seems trivial.
BigTTYGothGF · · focus · HN ↗
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.
TrianguloY · · focus · HN ↗
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
teekert · · focus · HN ↗
BerislavLopac · · focus · HN ↗
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.
BerislavLopac · · focus · HN ↗