Permalink
Browse files

.functions: Alias `diff` to `git diff` when available

  • Loading branch information...
1 parent 90e36ca commit c93d1134cc9bffdd872eb2a28368ef44ac01a326 @mathiasbynens committed Mar 23, 2012
Showing with 8 additions and 0 deletions.
  1. +8 −0 .functions
View
8 .functions
@@ -3,6 +3,14 @@ function md() {
mkdir -p "$@" && cd "$@"
}
+# Use Git’s colored diff when available
+hash git &>/dev/null
+if [ $? -eq 0 ]; then
+ function diff() {
+ git diff --no-index --color-words "$@"
+ }
+fi
+
# Create a data URL from an image (works for other file types too, if you tweak the Content-Type afterwards)
dataurl() {
echo "data:image/${1##*.};base64,$(openssl base64 -in "$1")" | tr -d '\n'

0 comments on commit c93d113

Please sign in to comment.