Go to file
2024-04-23 14:14:24 +02:00
.config added tilix config 2024-04-23 14:14:24 +02:00
.fonts Added Hack fonts 2020-08-02 10:09:03 +02:00
.functions added tilix config 2024-04-23 14:14:24 +02:00
.restic added restic inc/excl 2022-08-16 15:15:36 +02:00
.ssh created ssh-agent user systemd unit 2021-11-14 11:41:50 +01:00
.tilix added tilix config 2024-04-23 14:14:24 +02:00
.todo added todo config 2020-08-10 12:43:20 +02:00
.todo.actions.d customized add to todo.sh 2020-05-20 13:17:49 +02:00
.vim Added spelling function and se add file 2020-08-18 14:48:40 +02:00
bin added backup.sh 2022-09-30 10:59:55 +02:00
salt replaced GBT with new PS1 2021-11-11 16:27:24 +01:00
.alias added mariadb_backup alias 2023-11-07 15:56:06 +01:00
.bashrc changed default work computer 2022-09-27 11:34:17 +02:00
.curlrc added .curlrc 2022-01-19 10:22:57 +01:00
.dconf.conf added custom0 keybinding 2020-08-05 07:33:46 +02:00
.gitignore added ansible vault to ignore 2023-12-06 09:54:10 +01:00
.inputrc Prevent execution of pasting multi-line text 2020-11-05 14:07:27 +01:00
.tmux.conf removed powerline 2020-05-14 09:04:30 +02:00
.vimrc added spelling to cook files 2023-10-12 13:28:12 +02:00
README.md Added steps to new computer setup 2023-08-15 15:29:35 +02:00

title date draft tags
Dotfiles With Git 2020-04-29T13:26:01+02:00 true
bash
git
dotfiles

Simple way to manage dotfiles with git

I use a very simple way to manage my dotfiles with git and some bash aliases. All you have to create a folder for your git repository in your home folder and initiate a bare git repository

mkdir "$HOME/.dotfiles"
git init --bare "$HOME/.dotfiles"

Then create an alias so you don't have to write a long command each time you want to add a file or configure your git repository, don't forget to add that alias to $HOME/.alias

alias dotf='/usr/bin/git --git-dir=$HOME/.dotfiles --work-tree=$HOME'

so, that alias is calling git and sets the repository as well as working directory and it can be called from what ever path you currently be in.

The next thing we need to do is to configure the repository to not show untracked files and only care about the files we specifically want to manage.

dotf config --local status.showUntrackedFiles no

Now you just use the dotfiles alias for git to add files, commit changes, etc, etc

dotf add .alias .bashrc
dotf commit -m "Added .alias and .bashrc"

To show the status of the repository

dotf status

if you want to add some bash completion to dotf you can just add the following line to your .bashrc

[[ $(type -t __git_complete) == function ]] && __git_complete dotf __git_main

I use my functions defined in dotf.sh

If you want you can add a remote repository make sure that it's secure if you manage sensitive information.

dotf remote add origin <username>@git.domain.tld/dotfiles.git
dotf push

Adding new computer to existing dotfile repo

mkdir $HOME/.dotfiles
alias dotf='/usr/bin/git --git-dir=$HOME/.dotfiles --work-tree=$HOME'
dotf init
rm .inputrc
rm .bashrc
dotf remote add origin https://git.rre.nu/jonas/dotfiles.git
dotf config --local status.showUntrackedFiles no
dotf fetch origin
dotf checkout main

To initialize my desktop run

bash <(curl -sL https://git.rre.nu/jonas/dotfiles/raw/branch/master/bin/initDesktop)