My dotfiles.
Find a file
2025-09-23 19:26:59 +02:00
.bak feat(cmake): add install script 2025-08-27 18:45:31 +02:00
.config feat(broot): add syntax theme 2025-09-19 09:36:20 +02:00
.librewolf feat(librewolf): deactivate rfp 2025-04-02 22:33:09 +02:00
.local feat(apps): add podman desktop 2025-09-23 19:26:59 +02:00
.bash_aliases feat(bare repo): rename .cfg dir to .dot 2025-08-28 15:35:17 +02:00
.gitconfig feature: maintenance 2025-09-14 19:32:07 +02:00
.gitconfig.catppuccin chore(catppuccin): update themes 2025-02-15 17:41:42 +01:00
.gitconfig.personal refactor(git): update config 2025-09-11 10:43:20 +02:00
.gitignore feature(git): update global gitignore 2025-09-11 22:22:56 +02:00
.gitmessage feat(git): add config 2024-08-17 23:09:15 +02:00
README.md docs(bare repo): update readme 2025-08-28 15:42:43 +02:00

💾 Dotfiles: Bare git repository

https://www.atlassian.com/git/tutorials/dotfiles


The technique involves storing a Git bare repository in a "side" folder, such as $HOME/.dot or $HOME/.myconfig, using a specially crafted alias.

This ensures that commands are run against the repository itself and not the local .git folder, which could interfere with other Git repositories.

Starting from scratch

git init --bare $HOME/.dot
alias dot='/usr/bin/git --git-dir=$HOME/.dot/ --work-tree=$HOME'
dot config --local status.showUntrackedFiles no
echo "alias dot='/usr/bin/git --git-dir=$HOME/.dot/ --work-tree=$HOME'" >> $HOME/.bashrc
git init --bare $nu.home-path/.dot
alias dot = git --git-dir=($nu.home-path | path join .dot) --work-tree=($nu.home-path)
dot config --local status.showUntrackedFiles no
"alias dot = git --git-dir=($nu.home-path | path join .dot) --work-tree=($nu.home-path)" | save --append ($nu.home-path | path join .config/nushell/config.nu)
  • The first line creates a folder ~/.dot which is a Git bare repository that will track our files.
  • Then we create an alias dot which we will use instead of the regular git when we want to interact with our configuration repository.
  • We set a flag - local to the repository - to hide files we are not explicitly tracking yet. This is so that when you type config status and other commands later, files you are not interested in tracking will not show up as untracked.

Once you've run the setup, any file in the $HOME folder can be versioned using normal commands, replacing git with your newly created dot alias, such as:

dot status
dot add .vimrc
dot commit -m "Add vimrc"
dot add .bashrc
dot commit -m "Add bashrc"
dot push

Installing your dotfiles onto a new system (or migrate to this setup)

If you already store your configuration/dotfiles in a Git repository, on a new system you can migrate to this setup with the following steps:

  • Prior to the installation make sure you have committed the alias to your .bashrc or .zsh:
alias dot='/usr/bin/git --git-dir=$HOME/.dot/ --work-tree=$HOME'
alias dot = git --git-dir=($nu.home-path | path join .dot) --work-tree=($nu.home-path)
  • And that your source repository ignores the folder where you'll clone it, so that you don't create weird recursion problems:
echo ".dot" >> .gitignore
".dot" | save --append .gitignore
  • Now clone your dotfiles into a bare repository in a "dot" folder of your $HOME:
git clone --bare <git-repo-url> $HOME/.dot
git clone --bare <git-repo-url> ($nu.home-path | path join .dot)
  • Define the alias in the current shell scope:
alias config='/usr/bin/git --git-dir=$HOME/.dot/ --work-tree=$HOME'
alias dot = git --git-dir=($nu.home-path | path join .dot) --work-tree=($nu.home-path)
  • Check out the actual content from the bare repository to your $HOME:
dot checkout
  • The step above might fail with a message like:
error: The following untracked working tree files would be overwritten by checkout:
    .bashrc
    .gitignore
Please move or remove them before you can switch branches.
Aborting

This is because your $HOME folder might already have some stock configuration files which would be overwritten by Git. The solution is simple: back up the files if you care about them, remove them if you don't care. I provide you with a possible rough shortcut to move all the offending files automatically to a backup folder:

mkdir -p .dot-backup && \
dot checkout 2>&1 | egrep "\s+\." | awk {'print $1'} | \
xargs -I{} mv {} .dot-backup/{}
  • Re-run the check out if you had problems:
dot checkout
  • Set the flag showUntrackedFiles to no on this specific (local) repository:
dot config --local status.showUntrackedFiles no
  • You're done, from now on you can now type dot commands to add and update your dotfiles:
dot status
dot add .vimrc
dot commit -m "Add vimrc"
dot add .bashrc
dot commit -m "Add bashrc"
dot push