4 ms·
but many/most dotfiles reside at the top-level of your home directory, where it wouldn't be a good idea to initialize a VCS repository I totally disagree. I l
by e40 13y ago
but many/most dotfiles reside at the top-level of your home directory, where it wouldn't be a good idea to initialize a VCS repository
I totally disagree. I love having much of my home directory in git. I have a .gitiignore for the stuff I don't want in there, but the rest. Ahhhhh, so nice to be able to clone somewhere else and use.
- scottjad 13y agoMy main problem with this is it leads to accidentally executing git commands on your dotfiles repo. Like, say you thought ~/src/xulrunner was a git repo, but it was actually managed with hg or maybe was extracted from a tarball. Whereas normally executing some git command would complain that this is not a repo, if your ~ is a git repo then git will happily execute whatever you told it to on your dotfiles repo.
- Argorak 13y agoFor git repositories that are not touched very often, you can move the .git directory to something that isn't picket up automatically. Use it like this: mv .git dot_git git --git-dir="dot_git" add ... Thats also a nice trick if you need a git repos in a git repos, e.g. for integration test for libraries interacting with git.
- pielud 13y agoI take a similar approach. I have a dotfiles git repo in ~/dotfiles/ and have a Makefile which creates symlinks in my home directory. For example, ~/.bashrc is a symlink to ~/dotfiles/bashrc. That way, I can have a whitelist (whatever's in the Makefile) instead of a blacklist (like a .gitignore).
- zeckalpha 13y agoThe fake bare approach might be easier: http://mjollnir.org/blog/migrating-my-homedirectory-from-one-repo-to-many/ http://mjollnir.org/blog/migrating-my-homedirectory-from-one...
- cespare 13y agoI also keep my whole homedir in git, and it's great. My approach isn't to .gitignore, because I want to ignore almost everything -- I just add and commit things when I want to track them. One of my many git aliases[1] is 'git sn' for showing status without untracked files; this helps when dealing with my homedir: status --short --branch --untracked=no [1] https://github.com/cespare/dotfiles/blob/master/.gitconfig#L14 https://github.com/cespare/dotfiles/blob/master/.gitconfig#L...
- JoshTriplett 13y agoI actually prefer to .gitignore things explicitly, because then any new dotfiles show up in "git status" until I explicitly disposition them.
- oops 13y agoI have my homedir in git too and also ignore just about everything. I ended up using gitignore as a whitelist instead of a blacklist, e.g.: /* !/.gitignore !/.gitmodules !/.gitconfig !/.zshrc !/.zshenv !/.zsh !/.tmux.conf !/.vimrc !/.vim
- dgellow 13y agoI have a close setup. It just needs a little trick to add subdirectories : /* !/.emacs !/.emacs.d/ /.emacs.d/* !/.emacs.d/themes/ !/.emacs.d/functions/ You can check my .gitignore here [0]. [0] https://raw.github.com/dgellow/home/master/.gitignore https://raw.github.com/dgellow/home/master/.gitignore
- dhimes 13y agoI wondered about this, but I pose this question to you: what happens if you have a merge problem with, say, a libreoffice doc or something. How do you handle that? I use hg, but I imagine my plight would be similar. TIA.
- cespare 13y agoI don't keep anything but text files in my dotfile repo, so I haven't had to deal with this.
- 16s 13y agoBe careful, this is how devs expose private ssh keys.
- e40 13y agoI push it to a local git repo that has the same perms as my account and .ssh directory. But, I agree. You need to be careful.