Live data from Hacker News

.gitignore Isn't the only way to ignore files in Git

nelson.cloud

11–20 of 188 posts

Re: .gitignore Isn't the only way to ignore files in Git

#11
post #7

I use the ever living hell out of .git/info/exclude. Works great for scripts/Makefiles I only want locally and collaborators wouldn’t care about or be able to use.

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.

Re: .gitignore Isn't the only way to ignore files in Git

#12
Not sure where I picked up this, but I’ve added this to my global Git ignore:

    attic
That way you can just create an attic directory in any project where you can keep random stuff that should never be committed. I’ve yet to find a repo which actually has such a directory checker in.

Re: .gitignore Isn't the only way to ignore files in Git

#13
post #12

Not sure where I picked up this, but I’ve added this to my global Git ignore: attic That way you can just create an attic directory in any project where you can keep random stuff that should never be committed. I’ve yet to find a repo which actually has such a directory checker in.

I do this too! But I call it `.local`

Re: .gitignore Isn't the only way to ignore files in Git

#14
post #8

~/.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.

Re: .gitignore Isn't the only way to ignore files in Git

#16
post #8

~/.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.

Absolutely. On that subject, I prefer the Atlassian method for storing dotfiles in git but sometimes I feel like it's Mootools vs jQuery all over again.

Re: .gitignore Isn't the only way to ignore files in Git

#17
post #11
post #7

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

Yeah this is pretty much it.

Re: .gitignore Isn't the only way to ignore files in Git

#20
post #10

Earlier quoted context omitted.

git is a hell of a tool. It looks simple but is so beautifully versatile without being complex without being complex Uh, what?

What part of Enumerating objects: 15, done. Counting objects: 100% (15/15), done. Delta compression using up to 10 threads Compressing objects: 100% (8/8), done. Writing objects: 100% (8/8), 1.43 KiB | 1.43 MiB/s, done. Total 8 (delta 7), reused 0 (delta 0), pack-reused 0 (from 0) remote: Resolving deltas: 100% (7/7), completed with 7 local objects. don't you understand?!

Well, since I know what a delta is, and I know what an object is, I understand all of it.
Post reply on HN