Skip to content

Instantly share code, notes, and snippets.

@jcelliott
Created August 25, 2013 18:36
Show Gist options
  • Save jcelliott/6335485 to your computer and use it in GitHub Desktop.
Save jcelliott/6335485 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# ~/bin/home
# toggles source control on my home directory
# idea from [http://rhodesmill.org/brandon/2012/home-directory-vc/]
# colorized output
function cinfo() {
echo -e "\x1b[32m$1\x1b[0m" # green
}
function cwarn() {
echo -e "\x1b[33m$1\x1b[0m" # yellow
}
function cerror() {
echo -e "\x1b[31m$1\x1b[0m" # red
}
if [ -d $HOME/.git.off ]; then
mv $HOME/.git.off ~/.git || exit 1
cinfo "home directory version control activated"
elif [ -d $HOME/.git ]; then
mv $HOME/.git $HOME/.git.off || exit 1
cwarn "home directory version control deactivated"
else
cerror "home directory is not under version control"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment