The global/user wide exclude is a feature that should be more widely known. I frequently have people submitting changes to add their IDE/OS/AI/... files to every project's .gitignore. They are almost always pleasantly surprised when I tell them that they can add them to their standard configuration and have them ignored everywhere without bothering every project and without risk of accidentally committing them on a p…
.gitignore Isn't the only way to ignore files in Git
161–170 of 188 posts
Re: .gitignore Isn't the only way to ignore files in Git
#162Fun article, but it leaves out my favorite "almost ignore" feature in Git: `.gitattributes`. This file lets you specify that git should "ignore" the diff from certain files. For instance, Node projects have a `package-lock.json` that is pure noise from a Git standpoint (it's just massive amounts of diff specifying specific versions of libraries, and the real human-readable version is in a separate `package.json` file…
Re: .gitignore Isn't the only way to ignore files in Git
#163Earlier quoted context omitted.
Interested in examples of the types of scripts others collaborators wouldn't be able to use? Like scripts for PR workflows?
Usually when I'm working in one part of the codebase and I have sample data or something at a specific path on my local machine and Im testing the same thing over and over again will I make a Makefile or something and info/exclude it to help me keep focused. That's one way I use it.
git-home/
company-project/
This way, too, I can easily use the same ephemera scripts across multiple branches, or even multiple repos, concurrently.Re: .gitignore Isn't the only way to ignore files in Git
#164Fun article, but it leaves out my favorite "almost ignore" feature in Git: `.gitattributes`. This file lets you specify that git should "ignore" the diff from certain files. For instance, Node projects have a `package-lock.json` that is pure noise from a Git standpoint (it's just massive amounts of diff specifying specific versions of libraries, and the real human-readable version is in a separate `package.json` file…
Re: .gitignore Isn't the only way to ignore files in Git
#165~/.config/git/ignore and ~/.config/git/config is the proper place for your global git config and ignore instead of creating a ~/.gitignore_global and changing the config. IMO. my dotfiles are a lot smaller at the root level taking advantage of the ~/.config/ for a lot more things. the git exclude isn't used as much because it doesn't get committed to the repository so you'd have to recreate it each time you wanted to…
As a bonus, you can (should?) version control your `~/.config` dir to enable future revisions and sharing.
i find this better than putting all of ~/.config in git, since i don't necessarily want everything there to be version controlled.
video i learned this from: https://youtu.be/y6XCebnB9gs
gnu stow: https://www.gnu.org/software/stow/
Re: .gitignore Isn't the only way to ignore files in Git
#166The global/user wide exclude is a feature that should be more widely known. I frequently have people submitting changes to add their IDE/OS/AI/... files to every project's .gitignore. They are almost always pleasantly surprised when I tell them that they can add them to their standard configuration and have them ignored everywhere without bothering every project and without risk of accidentally committing them on a p…
I'd rather have a pristine repo (no .ds_store/.idea/etc) than a pristine .gitignore file.
Re: .gitignore Isn't the only way to ignore files in Git
#167Earlier quoted context omitted.
> you just want to see that the file changed I check the diff for uv.lock (Python counterpart of package-lock.json) every time I merge a PR. It is important to know which direct or transient dependencies have been updated. We don't blindly bump all dependencies to the latest versions (you shouldn't either).
Python packages aren't quite so insane on transitive dependencies. The diff of package-lock.json can be novel length.
pipdeptree --freeze
to see this clearlyRe: .gitignore Isn't the only way to ignore files in Git
#168Here's how I use the excludes file to set a different config for a project directory containing multiple repos: https://laszlo.nu/blog/project-level-git-config.html
I *literally* cannot read that yellow text on the white background. I even tried changing the brightness to almost 0, but there is just not enough contrast.
I'll fix it as soon as I'm in front of a computer. Happy Midsummer!
Re: .gitignore Isn't the only way to ignore files in Git
#169I have a habit of writing myself notes in various .txt files, and then not cleaning them up often enough so they end up cluttering my `git status` view. I ended up with a solution not mentioned in the article: create a `scratch` directory, and a `scratch/.gitignore` file containing just one line: `*`. This makes Git ignore everything in the scratch directory, including that same .gitignore file — so I never accidenta…
Re: .gitignore Isn't the only way to ignore files in Git
#170Fun article, but it leaves out my favorite "almost ignore" feature in Git: `.gitattributes`. This file lets you specify that git should "ignore" the diff from certain files. For instance, Node projects have a `package-lock.json` that is pure noise from a Git standpoint (it's just massive amounts of diff specifying specific versions of libraries, and the real human-readable version is in a separate `package.json` file…
People are jumping on it being an important file to review. You don't want to ignore the diff. Even if that's true, you definitely do not want to attempt merge two lock files, and using the .gitattributes file to set the merge strategy is a good idea!