30 lines
897 B
Markdown
30 lines
897 B
Markdown
|
# My Dotfiles using a bare git repository
|
||
|
|
||
|
## Setup repository and worktree
|
||
|
|
||
|
```bash
|
||
|
git init --bare $HOME/.dotfiles
|
||
|
alias dotfiles='/usr/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME'
|
||
|
# ideally place the alias into your shells alias file
|
||
|
dotfiles config --local status.showUntrackedFiles no
|
||
|
dotfile add [...]
|
||
|
dotfiles commit [...]
|
||
|
# Setup remote git repository
|
||
|
dotfiles push
|
||
|
```
|
||
|
|
||
|
## Install / restore dotfiles
|
||
|
|
||
|
```bash
|
||
|
echo ".dotfiles" >> .gitignore
|
||
|
git clone --bare <remote-git-repo-url> $HOME/.dotfiles
|
||
|
alias dotfiles='/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME'
|
||
|
dotfiles config --local status.showUntrackedFiles no
|
||
|
dotfiles checkout
|
||
|
```
|
||
|
|
||
|
### References
|
||
|
|
||
|
[Atlassian dotfiles git Guide](https://www.atlassian.com/git/tutorials/dotfiles)
|
||
|
[The best way to store your dotfiles](https://www.ackama.com/blog/posts/the-best-way-to-store-your-dotfiles-a-bare-git-repository-explained)
|