Created
August 31, 2011 18:42
-
-
Save DjMojoRisin/1184331 to your computer and use it in GitHub Desktop.
Checks if there are any uncommitted changes in the current git branch.
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/bash | |
# This tool checks if there are any uncommitted changes in the current git branch. | |
# If it finds any uncommited changes it exits with an error. | |
# We use it to prevent pushing dirty changes to production. | |
clean=$(git status | grep "nothing to commit (working directory clean)") | |
if [ -z "$clean" ]; then | |
echo There are uncommitted changes. | |
exit 1 | |
else | |
echo Branch is clean. | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment