Skip to content

Instantly share code, notes, and snippets.

@murar8
Last active April 8, 2022 18:37
Show Gist options
  • Save murar8/60074d1f6d222ee964382a594e7e3acb to your computer and use it in GitHub Desktop.
Save murar8/60074d1f6d222ee964382a594e7e3acb to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
REPO_URL=git@github.com:murar8/dotfiles.git
REPO_DIR=$HOME/.dotfiles
echo "Setup started"
echo "Repository: $REPO_URL"
echo "Target directory: $REPO_DIR"
echo
dot() {
git --git-dir=$REPO_DIR/ --work-tree=$HOME $@
}
cd $HOME
if ! command -v git >/dev/null; then
echo "Error: could not locate git in your path."
exit 1
fi
if [ ! -d $REPO_DIR ]; then
git clone --bare $REPO_URL $REPO_DIR
dot config status.showUntrackedFiles no
echo
fi
STASH_NAME="backup-$(date +%F)"
echo "Stashing potential conflicts in $STASH_NAME"
dot -c user.name=$USER -c user.email=$USER@localhost stash save $STASH_NAME
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment