Skip to content

Instantly share code, notes, and snippets.

@wangbinyq
Last active June 22, 2018 10:10
Show Gist options
  • Save wangbinyq/8766efa331a526935980c2710ef94721 to your computer and use it in GitHub Desktop.
Save wangbinyq/8766efa331a526935980c2710ef94721 to your computer and use it in GitHub Desktop.

Revisions

  1. wangbinyq revised this gist Jun 22, 2018. 1 changed file with 14 additions and 0 deletions.
    14 changes: 14 additions & 0 deletions cfg-clone.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    git clone --bare https://bitbucket.org/durdn/cfg.git $HOME/.cfg
    function config {
    /usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME $@
    }
    mkdir -p .config-backup
    config checkout
    if [ $? = 0 ]; then
    echo "Checked out config.";
    else
    echo "Backing up pre-existing dot files.";
    config checkout 2>&1 | egrep "\s+\." | awk {'print $1'} | xargs -I{} mv {} .config-backup/{}
    fi;
    config checkout
    config config status.showUntrackedFiles no
  2. wangbinyq created this gist Jun 22, 2018.
    4 changes: 4 additions & 0 deletions cfg-init.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,4 @@
    git init --bare $HOME/.cfg
    alias config='/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME'
    config config --local status.showUntrackedFiles no
    echo "alias config='/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME'" >> $HOME/.bashrc