summaryrefslogtreecommitdiff
path: root/zsh/zscripts/nicegit.zsh
diff options
context:
space:
mode:
Diffstat (limited to 'zsh/zscripts/nicegit.zsh')
-rwxr-xr-x[-rw-r--r--]zsh/zscripts/nicegit.zsh15
1 files changed, 14 insertions, 1 deletions
diff --git a/zsh/zscripts/nicegit.zsh b/zsh/zscripts/nicegit.zsh
index 5aab8e0..faa7987 100644..100755
--- a/zsh/zscripts/nicegit.zsh
+++ b/zsh/zscripts/nicegit.zsh
@@ -3,11 +3,16 @@
alias \
ga="git add" \
gpl="git pull" \
- gps="git push" \
+ gph="git push" \
gl="git log" \
function gc() {
+ if ! __is_diff; then
+ echo "Nothing to commit, working tree clean"
+ return
+ fi
+
if [[ "$@" != "" ]]; then
commit="$@"
else
@@ -15,3 +20,11 @@ function gc() {
fi
git commit -m "$commit"
}
+
+function __is_diff() {
+ ! git diff --quiet HEAD $REF -- $DIR
+}
+
+function gdf() {
+ __is_diff && git diff HEAD $RED -- $DIR || echo "Repo is unchanged"
+}