Skip to content

Commit 4627151

Browse files
committed
Change wording on bare-dotfiles post
1 parent 840c211 commit 4627151

1 file changed

Lines changed: 19 additions & 11 deletions

File tree

content/posts/bare-dotfiles.md

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: 'Bare Dotfiles Repository: how to do "sparse checkouts"'
2+
title: 'Bare Dotfiles: how to do "sparse checkouts" on Different Machines'
33
draft: false
44
date: 2026-02-03
55
---
@@ -13,7 +13,7 @@ definitely read the short tutorial if you haven't, but it basically advices you
1313
to create a bare repository and a shell alias to reference that repository:
1414

1515
```bash
16-
$ git clone --bare <repo_url> ~/Documents/dotfiles
16+
$ git clone --bare "<repo_url>" ~/Documents/dotfiles
1717
$ alias dot='git --git-dir="$HOME/Documents/dotfiles" --work-tree="$XDG_CONFIG_HOME"'
1818
```
1919

@@ -34,19 +34,21 @@ config folder) is not touched yet. If we would continue the examples from the
3434
blog post, we would checkout the main branch with `dot checkout` which would
3535
possibly fail with the message that files could be overwritten.
3636

37-
To solve this problem, I recommend to create a new [orphan branch][orphan] and
38-
manually checking out the configs you need on this specific machine. For
39-
example, to only use my Neovim config on this machine:
37+
To solve this problem, I recommend to create a new [orphan branch][orphan]:
4038

39+
```bash
40+
$ dot switch --orphan "$(hostname)"
41+
```
42+
43+
Now we have a branch with no parent (hence _orphan_) and gave it the name of
44+
the machine. Now, we can manually checkout configs we would like to use on this
45+
machine. If I for example only want to use my Neovim config on this machine:
4146

4247
```bash
43-
$ dot switch --orphan $(hostname)
4448
$ dot restore -s main -- nvim
4549
```
4650

47-
The `--orphan` flag is optional, but it prevents that the first commit to the
48-
new branch is a "I deleted almost everything except these configs" commit.
49-
51+
Note: this is the same as `dot checkout main -- nvim`.
5052

5153
## Bonus: Ignore Local Config
5254

@@ -56,8 +58,14 @@ really want to ignore them, I add them to Git's local ignore file
5658
`$GIT_DIR/info/exclude`. Here's a Git alias I use for it:
5759

5860
```bash
59-
$ config config alias.exclude "!echo "${1?no argument}" >> $(git rev-parse --git-path info/exclude) && :"
60-
$ config exclude htop
61+
$ dot config alias.exclude \
62+
'!echo "${1?no argument}" >> $(git rev-parse --git-path info/exclude) && :'
63+
```
64+
65+
Which allows me to ignore a single config:
66+
67+
```bash
68+
$ dot exclude htop
6169
```
6270

6371
[bare]: https://git-scm.com/docs/git-clone.html#Documentation/git-clone.txt---bare

0 commit comments

Comments
 (0)