Go to file
2020-08-01 13:48:16 +02:00
.config added my dotfiles 2020-03-30 08:56:05 +02:00
.local/bin GBT car for todo.sh 2020-05-20 12:12:08 +02:00
.todo Added todo.sh 2020-05-20 11:28:48 +02:00
.todo.actions.d customized add to todo.sh 2020-05-20 13:17:49 +02:00
.vim/autoload added pathogen 2020-07-31 12:58:25 +02:00
bin added initDesktop 2020-08-01 13:45:28 +02:00
salt better salt alias 2020-08-01 13:48:16 +02:00
.alias better salt alias 2020-08-01 13:48:16 +02:00
.bashrc new sps completion 2020-06-13 17:17:25 +02:00
.functions.sh cleaned up gnome bindings 2020-08-01 11:08:49 +02:00
.gbt.sh Typo in GBT car 2020-05-20 12:14:43 +02:00
.gbts_theme.sh added my dotfiles 2020-03-30 08:56:05 +02:00
.tmux.conf removed powerline 2020-05-14 09:04:30 +02:00
.vimrc tweaked date insert 2020-07-30 16:45:20 +02:00
README.md Added vim state 2020-07-31 15:12:20 +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 dotf)" == "alias" ]] && [[ "$(type -t __git_complete)" == "function" ]] && __git_complete dotf _git

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