Skip to content

Instantly share code, notes, and snippets.

@brwyatt
Last active August 29, 2015 14:07
Show Gist options
  • Save brwyatt/1817c7802eba6916f80d to your computer and use it in GitHub Desktop.
Save brwyatt/1817c7802eba6916f80d to your computer and use it in GitHub Desktop.
Handy Aliases for BASH
# Update all repositories under ~/repos.
# Works for SVN and GIT (very simplistic)
alias update-repos="ls ~/repos | xargs -I% bash -c 'echo -e \"\e[0;34mUpdating %\e[0m\"; cd ~/repos/% ; if [ -d .svn ]; then svn update; elif [ -d .git ]; then git fetch -v; else echo -e \"\e[0;31mNot a repo\e[0m\"; fi'"
# Calls `svn diff` and adds some color to the output to make changes stand out
alias colordiff="svn diff | sed -E 's/^(@@.*@@)$/\x1b[0;34m\1\x1b[0m/' | sed -E 's/^(Index: .*|=*)$/\x1b[0;33m\1\x1b[0m/' | sed -E 's/^(\+.*)$/\x1b[0;32m\1\x1b[0m/' | sed -E 's/^(\-.*)$/\x1b[0;31m\1\x1b[0m/' | less -R"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment