While I always hate the cluttering of "top" directories, id think something more like `.gitignore.local` at the top level would be much better than where its hidden
I prefer to list individual directories and files in my ~/.gitignore so that I see when new files show up and I can decide whether to ignore them, commit them, or prevent them from getting generated.
I can't wait until you discover that you can put .gitignore into
a subdirectory and also add the .gitignore to itself (e.g. by using an
asterisk or adding it explicitly).
I also (mis)used .gitignore before I realised that there was an easy way to ignore stuff that I have locally without having to commit/ignore a .gitignore file.
ah, lol. yeah, that's a good point, that scenario could definitely be smarter - I wasn't thinking about it listing the directory first. plus the time between list and "look again for .gitignore" is small enough that any inconsistencies could very reasonably be labeled an acceptable resolution to a race between git and other file system changes.
I 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.
If you don't like .git directories you can create a bare repo. That puts all of git's internal stuff at top level and makes it visible. But then you have to set up your working directory somewhere else.
What about adding .myname-local folder(Or some other name nobody else will use) which is actually a symlink to a separate repo.local folder.
Use a global gitignore to ignore the symlink.
You could even have a script to git clone, make the local dir, and git init it.
Ideally some kind of global convention could be defined for the local folder name, for consistency, reusable tools, and so everyone could know to stay away from it for nonlocal stuff.
I always do. My company has a canonical .gitignore that we update when we see things in git repos that should not be there. It now contains all of the stupid hidden project directories for all of the major IDEs, build artifacts we don't want, and a bunch of other stuff.
reply