Reputation: 3046
I have read this article, describing how to use git and configure dot files over many computers: https://www.atlassian.com/git/tutorials/dotfiles
The author uses a bare repository and changes the working directory to $HOME for the dot files. Why does the author use a bare repository in this context? Could you just not take a normal repository and set the WORK_DIR to the $HOME directory?
Upvotes: 1
Views: 912
Reputation: 21
A few other alternatives I like are:
to place your files in a separate gitable directory and use GNU Stow to symlink them https://dev.to/luxcih/dotfiles-managing-with-gnu-stow-and-git-5100
to let Chezmoi manage them https://www.chezmoi.io
Upvotes: 2
Reputation: 809
Using bare repo like that, can aovid caring lots of unknow files under your $HOME
I prefer this:
mkdir ~/dotF
cd ~/dotF
git init
then put files I know in the stand alone folder, and set some soft-links.
Just like a U-disk
Upvotes: 1
Reputation: 76774
You can indeed do that.
It's not clear to me why the author chose to do that, but in general, making your home directory a Git repository means you have to ignore almost all files by default and either add exceptions or add new files with git add -f
, or else every file anywhere under your home directory will be considered an untracked file in your repository. Using a bare repo with a special alias means that by default, your home directory won't be considered a repository, avoiding all those problems.
Another option that you can use is to use a normal repository located elsewhere and have a script or Makefile to copy the files into place.
Upvotes: 4