3 ms·
I'm of the same opinion as you, here. I generally have 10+ "extra" files in my project directory (output files, notes, one-off scripts for certain things, etc).
by RHSeeger 3y ago
I'm of the same opinion as you, here. I generally have 10+ "extra" files in my project directory (output files, notes, one-off scripts for certain things, etc). When I add files to a commit, I do it by filename, never "everything that's new/changed". I don't have a use case for "everything I've created/changed goes into the commit, always".
> switch to another branch, the files will still be in your working copy but not listed in your .gitignore file
This is a failing of git, imo. There should be a .local.gitignore to somesuch, that is "added to" .gitignore. It's VERY common for me to have files that I want ignore, but are specific to me; they don't belong in the project's .gitignore. I know there are ways to do this, but all of them are clunky. There should be a simple, out of the box way to do it.
- masukomi 3y agoi always have a large pile of temp files and such that should never be committed but it's never been a problem because i never use `git add .` i use `git add -u` which is "only add things that are already being tracked" there's a newer flag for the same thing but my brain is hardcoded to the old "-u" option from "back in the day". It feels like a "simple, out of the box way to do it" to me.
- vdfs 3y agoAdd those files to `.git/info/exclude` and they won't show up in `git status`
- josephg 3y agoI do the same, but in all the mess that git status outputs, I occasionally forget to git add some required source code - which leaves entire chains of commits in my repository in a broken, impossible to compile or run state. Worse, I don’t notice until I try to run the code on another computer - and find I’m missing data. Having a “local gitignore” makes a lot more sense. I’d like to be more explicit about which local files should be ignored.
- vdfs 3y agoThere actually a local .gitignore, it's called or located at .git/info/exclude You can even ignoring changes in files that are already tracked with `git update-index --assume-unchanged <file>`
- arp242 3y ago> There should be a .local.gitignore to somesuch I think .git/info/exclude is what you're looking for? (and also the global ~/.config/git/ignore)
- RHSeeger 3y agoI've used that file before but... it always felt sort of hacky. And every time I want to use it, I need to figure out where it is. It really feels like there should be a more obvious, straight forward way to do it. Admittedly, "user friendly" is not git's strong suit.
- arp242 3y agoThe .git directory seems like the obvious location for it; I agree that info/exclude isn't the most obvious path (I had to look up what the exact path was again for my previous comment), but all things considered that seems like a minor issue. I suppose you could symlink .git/ignore to .git/info/exclude or something in the git template.
- RHSeeger 3y ago> The .git directory seems like the obvious location for it The same location as .gitignore seems like the obvious location for it, to me.
- nickspain 3y agoThese might be the clunky way your talking about but you can have “private” git ignored either in ‘.git/info/exclude’ in the repo or in the ‘core.excludesfile’ set in your git config. The later is quite nice because you could actually version control that elsewhere if you version control your system config.