Skip to content

Instantly share code, notes, and snippets.

@gathuku
Last active May 16, 2020 13:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gathuku/57042caae7da7f2a1019ad321f7f754f to your computer and use it in GitHub Desktop.
Save gathuku/57042caae7da7f2a1019ad321f7f754f to your computer and use it in GitHub Desktop.
Check git changes with scripts
# returns true if changes present
if [[ `git status --porcelain` ]]; then
echo "Changes";
else
echo "No changes";
fi
# Check for a more specific file
# includes its name
if [[ `git status --porcelain index.html` ]]; then
echo "index.html has changes";
else
echo "No changes in index.html";
fi
# returns true if changes present
if [[ `git status --porcelain` ]]; then
echo "Changes";
else
echo "No changes";
fi
# Check for a more specific file
# includes its name
if [[ `git status --porcelain index.html` ]]; then
echo "index.html has changes";
else
echo "No changes in index.html";
fi
# returns true if changes present
if [[ `git status --porcelain` ]]; then
echo "Changes";
else
echo "No changes";
fi
# Check for a more specific file
# includes its name
if [[ `git status --porcelain index.html` ]]; then
echo "index.html has changes";
else
echo "No changes in index.html";
fi
# returns true if changes present
if [[ `git status --porcelain` ]]; then
echo "Changes";
else
echo "No changes";
fi
# Check for a more specific file
# includes its name
if [[ `git status --porcelain index.html` ]]; then
echo "index.html has changes";
else
echo "No changes in index.html";
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment