Ask HN: Turn my home directory into a Git repo?

6 points by mangeletti ↗ HN
I'm on OS X, but this question is of course relevant to Linux as well:

I was thinking of making my home directory into a Git repo, so that I could easily see when new files (hidden or otherwise) are added by programs I use, and so that I could just generally track changes. I would probably add directories like Music, etc. to .gitignore to avoid bloat.

Some of the things that would be interesting to notice are all the little hidden configuration files that build up over time, e.g.:

.android, .bash_history, .bash_profile, .bash_profile.pysave, .boot2docker, .cache, .cleanup, .config, .cups, .docker, .fctsslvpnhistory, .filezilla, .gitconfig, .heroku, .ipython, .local, .netrc, .node-gyp, .npm, .oracle_jre_usage, .pip, .putty, .python_history, .swt, .thinkorswim, .v8flags.3.28.71.19.me.json, .vim, .viminfo, .virtualenvs

Do you have any thoughts on doing this? Is it a terrible idea?

9 comments

[ 3.1 ms ] story [ 24.5 ms ] thread
It is an interesting idea. I would recommend you to start and then make the .gitignore grow with things you don't need. Your list is already big enough to start. Looking forward to see how your experiment goes.
This depends on how you manage your computer. If you put all your personal projects in your home directory this could be a pita. Really what you'll need to do is to make heavy use of gitignore. Obviously bash_history changes on every command so that may be one you want to avoid tracking. You may also want to take a look at dotfiles repos on github, which are meant for actively tracking your configuration files instead of seeing what new files have been added.
I do something similar, so I know it's feasible. I whitelist the dotfiles that I want to keep hold of (.vim, .bashrc, &c.) in my homefolder and whenever I update something, I just push to the remote.

It's really enlightening to see just how quickly a perfectly clean home folder can get filled with hidden directories.

Thanks everyone herein for the advice!
Just put * in your gitignore. Then everything you don't add is ignored.

Edit: Oh, this doesn't help you with seeing what new stuff is added, at least not in the root of the tree. But it's a useful trick.