Hacker Read top | best | new | newcomments | leaders | about | bookmarklet login

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


sort by: page size:

Local files like that are fine, just keep them in your .gitignore

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.

You can also use a global .gitignore file in your home directory. Useful for vim's swap files, for example.

That's cool!

You can also put local gitignore rules in .git/info/exclude , but i have a hard time remembering that exact path for some reason.


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

No, just add the directory to .gitignore.

That makes sense but not everyone uses git. A new file that you can point to your gitignore in would probably be a good idea.

Why not just use .gitignore as a default (if local indexing is enabled)?

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.

You can add it to .git/info/exclude. That's a gitignore that's repo-local.

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.


>.gitignore

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.

https://stackoverflow.com/questions/7632454/how-do-you-use-g...


It would probably make sense to default to using .gitignore if a .kiteignore hasn't been specified; likely the same things that you'd want hidden.

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.


If I have local "dirty" state that I need to hold on to, I just hide it in a temp directory like this:

  mkdir temp
  echo '*' >temp/.gitignore
Quick, dirty, effective. :)

.gitignore helps

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.

I highly recommend this approach.

next

Legal | privacy