Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

For many years I've have a git-ignored ".not-committed" folder in all of my repos for throwing extra anything into. It's been a huge life saver!
 help



You can just add it in a user-level gitignore instead of ignoring it in every repo. See: ~/.config/git/ignore

I only realized very recently that being able to specify .gitignore files in any part of a repo can be combined with wildcards to just put `.gitignore` with `*` in a arbitrary directories to make them get ignored without needing to modify any wider configuration.

I'm doing that all the time. Starting with a .vim directory that contains vim-specific files, such as scripts / build commands to be run on certain key combinations, to ".misc" / ".scratch" / ".notes" / ".api-keys" directories... I wouldn't want to list them all in my global .gitignore because I'd certainly forget half of the names I tend to give to these...

This has the disadvantage though, that this user level gitignore file will not be in the repo, which means that other less careful contributors have to fix ignoribg for themselves.

And then you have a known path to script up all your repos' stuff for backup

yes, but user level is not a repo level

Yes, but this is exactly the sort of thing that should be a user-level configuration. A personal scratch directory has nothing to do with the repository itself and doesn’t belong in a repo’s .gitignore.

If it's only needed for one particular checkout, .git/info/exclude is the other obvious option.


You don't need to put the scratch directory in the committed gitignore file. gitignore files are recursive. So a common approach is to use a gitignore with * in the scratch directory.

i usually do "*ignorethis*", so a file with .ignorethis extension does not strictly have to be under a specific directory, this might save context somewhere. similar approach but yeah, a huge life saver!



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: