Remix.run Logo
ktm5j a day ago

Just a nit-pick, but some/repo/path/.gitignore isn't necessarily committed to the repo. For example, if your repo has no .gitignore file, you can totally add one in your clone without adding it to the tree. Of course then you can't do something like `git add .` without committing it.

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

infogulch a day ago | parent | next [-]

I've been using $REPO/.scratch/ and .scratch/.gitignore with just `*` in it as a place for coding agents to use as temp storage (scripts, exports, plans, etc) that won't get committed. It's much easier to access these files under the repo path instead of wading through /tmp.

crtasm a day ago | parent | prev | next [-]

Out of the box you can use ~/.config/git/ignore and ~/.config/git/config

ktm5j a day ago | parent [-]

I have no ~/.config/git directory, ~/.config/git/config might take higher precedence, but ~/.gitconfig works too.

crtasm a day ago | parent [-]

Yes you may have to create the directory :)

nom a day ago | parent | prev | next [-]

you can add .gitignore to .gitignore ;)

ktm5j a day ago | parent | next [-]

True! But a gotcha there is that if your repo does have a .gitignore in the tree then this trick won't work. I had a coworker try to do just that and we were all pretty confused when his changes kept getting committed. `git add ./` will stage changes to any file in the commit tree, even if that file matches a line in gitignore.

a day ago | parent | prev | next [-]
[deleted]
spider-mario a day ago | parent | prev | next [-]

In fact tup does exactly that to the .gitignores it generates.

sinabis 21 hours ago | parent | prev [-]

yes, that works perfectly

a day ago | parent | prev | next [-]
[deleted]
moritzwarhier 21 hours ago | parent | prev [-]

Wait until you learn about

  .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

happymellon 19 hours ago | parent [-]

Nah, I generate dependency trees from gradle because of the crappy way current $job has aggressive transient dependency scanning and I can't stand just updating someone else's transient dependency without validating that there isn't at least a new version of whatever pulled it in.

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 18 hours ago | parent | next [-]

Fair, and sorry, my tone was a bit off, I didn't think much when commenting.

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.

18 hours ago | parent | prev [-]
[deleted]