Last time I mentioned that I use multiple backup copies of my .env
file. One problem with that approach was they they cluttered my Git status (or the magit-status
window). I could put the relevant pattern in my .gitignore
file, but I didn’t want to bother other programmers in the team with peculiarities of my personal setup.
Well, quite unsurprisingly, Git does support ignoring files without putting them in .gitignore
. You can use the file .git/info/exclude
, which has the same format as .gitignore
, but is not committed to the repository.
One gripe I had was that I knew that Magit supported ignoring files by putting the point over them and pressing i
(magit-gitignore
). But this puts them in .gitignore
, not in .git/info/exclude
. I thought “well, it’s the second time in my life when I need some feature of Git that Magit doesn’t support”.
Or is it? I decided to try C-u i
, and wow, here it is! Had I read the docstring, I would knew that. Interestingly, this seems not to be mentioned in the manual. This might mean that skimming through the Magit sources and looking at the docstrings might reveal more little gems like that!