diff --git a/zsh/.config/zsh/functions.zsh b/zsh/.config/zsh/functions.zsh index ae77ead..42bd1d4 100644 --- a/zsh/.config/zsh/functions.zsh +++ b/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 }