43 lines
1.0 KiB
Markdown
43 lines
1.0 KiB
Markdown
|
# Bare Git Repository
|
||
|
|
||
|
- https://www.atlassian.com/git/tutorials/dotfiles
|
||
|
- StreakyCobra
|
||
|
|
||
|
## Starting from scratch
|
||
|
|
||
|
```
|
||
|
git init --bare $HOME/.dotfiles
|
||
|
alias dotfiles='/usr/bin/git --git-dir=$HOME/.dotfiles --work-tree=$HOME'
|
||
|
dotfiles config --local status.showUntrackedFiles no
|
||
|
```
|
||
|
|
||
|
## Install onto a new system
|
||
|
|
||
|
```
|
||
|
alias dotfiles='/usr/bin/git --git-dir=$HOME/.dotfiles --work-tree=$HOME'
|
||
|
|
||
|
echo ".dotfiles" >> .gitignore
|
||
|
git clone --bare <git-repo-url> $HOME/.dotfiles
|
||
|
dotfiles checkout
|
||
|
dotfiles config --local status.showUntrackedFiles no
|
||
|
```
|
||
|
|
||
|
The step above might fail with a message.
|
||
|
This is because your $HOME folder might already have some stock configuration
|
||
|
files which would be overwritten by Git.
|
||
|
I provide you with a possible rough shortcut to move all the offending files
|
||
|
automatically to a backup folder:
|
||
|
|
||
|
```
|
||
|
mkdir -p .dotfiles-backup
|
||
|
dotfiles checkout 2>&1 | egrep "\s+\." | awk {'print $1'} | \
|
||
|
xargs -I{} mv {} .dotfiles-backup/{}
|
||
|
```
|
||
|
|
||
|
## Other Tools
|
||
|
|
||
|
```
|
||
|
lazygit --git-dir=$HOME/.dotfiles --work-tree=$HOME
|
||
|
```
|
||
|
|