How to use Github to manage dotfiles?

前端 未结 7 739
萌比男神i
萌比男神i 2020-12-24 13:08

I stored my dotfiles in github, with lots pains, because of no automation. I have to update it myself.

Is there a way that can auto install/update/sync dotfiles? I m

7条回答
  •  梦毁少年i
    2020-12-24 13:47

    I found an interesting way to use plain git to manage your dotfiles, no symlinks needed. This way, you should be able to do push and pull the usual way:

    Setup

    git init --bare $HOME/.myconf
    alias config='/usr/bin/git --git-dir=$HOME/.myconf/ --work-tree=$HOME'
    config config status.showUntrackedFiles no
    

    where my ~/.myconf directory is a git bare repository.

    Usage

    The usual git commands can then be used with the git alias, e.g. config or whatever you choose.

    config status
    config add .vimrc
    config commit -m "Add vimrc"
    config push
    

    Benefits

    • No extra tooling
    • no symlinks

    More Infos

    • Source: https://news.ycombinator.com/item?id=11071754
    • Article with further infos: https://developer.atlassian.com/blog/2016/02/best-way-to-store-dotfiles-git-bare-repo/

提交回复
热议问题