From fcb1d4fa276bb1544d3ad47c27931c63fde3d297 Mon Sep 17 00:00:00 2001
From: Timmy Keller <tjk@tjkeller.xyz>
Date: Sat, 5 Nov 2022 14:39:31 -0500
Subject: make nicegit better

---
 zsh/zscripts/nicegit.zsh | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
 mode change 100644 => 100755 zsh/zscripts/nicegit.zsh

(limited to 'zsh/zscripts/nicegit.zsh')

diff --git a/zsh/zscripts/nicegit.zsh b/zsh/zscripts/nicegit.zsh
old mode 100644
new mode 100755
index 5aab8e0..faa7987
--- 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"
+}
-- 
cgit v1.2.3