7 ms·
I have been using the "bare git at $HOMEDIR"[0] approach for several years. Benefits: 1. no extra tools. 2. one off task for setting up the git repo and alia
by nrvn 1y ago
I have been using the "bare git at $HOMEDIR"[0] approach for several years.
Benefits:
1. no extra tools.
2. one off task for setting up the git repo and alias `dotfiles='/usr/bin/git --git-dir=${HOME}/.config/dotfiles --work-tree=${HOME}'`
3. all files are where they are, no symlinks, copies, etc.
Caveats:
1. $HOME/.gitignore just ignores everything because it contains a single "*" char[1]. So adding new files must be done with dotfiles add -f ~/.newfile to track.
Refs:
[0] - https://www.atlassian.com/git/tutorials/dotfiles https://www.atlassian.com/git/tutorials/dotfiles
[1] - https://github.com/nrvnrvn/dotfiles/blob/main/.gitignore https://github.com/nrvnrvn/dotfiles/blob/main/.gitignore
- deleted 1y ago[deleted]
- hk1337 1y agoI don’t do the * in the gitignore because I use the confit alias and disable showing untracked files. That way I can use the .gitignore in the home as my global gitignore I love the bare repo method though. I’ve been using it for several years and haven’t had a need for another
- yencabulator 1y agoYou can use ~/.config/git/ignore (core.excludesFile).
- hk1337 1y agoIs that an automatic/default setting or did you just pick that path and you have to set the ignore filename in .gitconfig? Because, I know I could name it ~/.gitignore_global too.
- yencabulator 1y agoThat's the default path, you can change it. Original comment has the config variable.
- hk1337 1y agothat's pretty cool. I didn't realize that. when I first started that wasn't how it was being used so I never picked up on it. Using .config/git/ saves me a couple of lines in the config file.
- akdev1l 1y agoI like this a lot. The caveat is not that bad because anyway with stow or other solutions you still need to add things manually. I believe one could even add stuff like `!.bashrc` to the gitignore so it can keep track of these files automatically. Hence we could have template .gitignore for most common use cases.