Skip to content

Instantly share code, notes, and snippets.

@jtpaasch
Created August 14, 2013 14:24
Show Gist options
  • Save jtpaasch/6231539 to your computer and use it in GitHub Desktop.
Save jtpaasch/6231539 to your computer and use it in GitHub Desktop.
Checks if there are any new changes in a repo.
#!/bin/bash
# The git comamnd `git status --porcelain`
# will return a list of files that have changed.
# We'll redirect the output to /dev/null
# so that the results of the command don't get
# printed to the screen.
CHANGED=no
if git status --porcelain | >/dev/null ; then
CHANGED=yes
fi
# We could also pipe the command through a grep,
# if we want to check that certain files or folders
# have changed.
CHANGED=no
if git status --porcelain | grep 'app/public/assets' | >/dev/null ;
CHANGED=yes
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment