Mariano Z. пре 9 месеци
родитељ
комит
9aba368f6c
1 измењених фајлова са 13 додато и 2 уклоњено
  1. 13 2
      zsh/.config/zsh/functions.zsh

+ 13 - 2
zsh/.config/zsh/functions.zsh

@@ -301,7 +301,18 @@ if command -v bombadil &> /dev/null; then eval "$(bombadil generate-completions
 if command -v eza &> /dev/null; then compdef eza=ls; fi
 
 function dc() {
+  if ! git rev-parse --is-inside-work-tree &>/dev/null; then
+    echo "Error: Not in a git repository"
+    return 1
+  fi
+
+  if [[ -z $(git status --porcelain) ]]; then
+    echo "No changes to commit"
+    return 0
+  fi
+
   git add .
-  git commit -m 'automated dev commit' --no-gpg-sign
-  git push
+  local timestamp=$(date +"%Y-%m-%d %H:%M:%S")
+  git commit -m "dev: automated commit - ${timestamp}" --no-gpg-sign
+  git push &>/dev/null
 }