From 84e97f3370757bca5c41af340a92f0177ecfb68b Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 2 Mar 2026 14:32:32 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96=E4=BA=86=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- g.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 g.sh diff --git a/g.sh b/g.sh new file mode 100755 index 0000000..acaa3f5 --- /dev/null +++ b/g.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash +# 快速 git add + commit + push +# 用法: g "fix: 提交说明" +set -e + +msg="${1:-}" +if [[ -z "$msg" ]]; then + echo "用法: g \"commit message\"" + echo "示例: g \"fix: 修复登录问题\"" + exit 1 +fi + +# 检查是否有改动 +if [[ -z $(git status --porcelain) ]]; then + echo "无文件改动,跳过提交" + exit 0 +fi + +git add . +git commit -m "$msg" +git push +echo "✓ 已推送"