blob: bf6f6625bcb4888390471092c447ebec6ec4b773 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
# newDotFiles
This is where i keep my dotfiles and scripts.
## Dotfile management
I use [this](https://developer.atlassian.com/blog/2016/02/best-way-to-store-dotfiles-git-bare-repo/) method of managing dotfiles
If the link above is broken, here is a short summary.
The method comes from this [thread](https://news.ycombinator.com/item?id=11070797). The idea is to transform your home folder into a git repository, and then add the files you edited.
### First time setup
Make a new bare github repository
Initialize git
`git init --bare $HOME/.cfg`
Add the easy to use alias
`alias config='/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME'`
Set git option
`config config --local status.showUntrackedFiles no`
This is important, because othervise git vil print every file in your home directory.
Remember to add `alias config='/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME'` to your shellrc
Now commands like `config add`, `config commit`, `config push` and `config pull` can be used to manage and sync you config files to github.
### Add to new computer
Configure the alias
`alias config='/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME'`
Make gitignore
`echo ".cfg" >> .gitignore`
Clone repository
`git clone --bare <git-repo-url> $HOME/.cfg`
Set git option
`config config --local status.showUntrackedFiles no`
Checkout
`config checkout`
Backup or delete files that conflict this command and then run `config checkout` again
And turn off the tracking
`config config --local status.showUntrackedFiles no`
|