Created
February 4, 2018 10:48
-
-
Save hectorm/8891f7f1916a4379f84dfaccc6fa117f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -eu | |
GIT_DIR="${HOME}/.dotfiles"; | |
GIT_CMD="${1:-}" | |
dotgit() { | |
git --git-dir="${GIT_DIR}" --work-tree="${HOME}" "$@" | |
} | |
if [ "${GIT_CMD}" = 'dotinit' ]; then | |
git init --bare "${GIT_DIR}"; | |
dotgit config --local status.showUntrackedFiles no | |
elif [ "${GIT_CMD}" = 'dotclone' ]; then | |
GIT_REPO="$2" | |
git clone --bare --recursive "${GIT_REPO}" "${GIT_DIR}" | |
dotgit config --local status.showUntrackedFiles no | |
dotgit checkout --force | |
elif [ "${GIT_CMD}" = 'dotsave' ]; then | |
GIT_MESSAGE="${2:-$(date +%s)}" | |
dotgit commit --all -m "${GIT_MESSAGE}" | |
dotgit push origin master | |
else | |
dotgit "$@" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment