fix: 优化了代码

This commit is contained in:
Daniel
2026-03-02 14:32:32 +08:00
parent 049276fedd
commit 84e97f3370

22
g.sh Executable file
View File

@@ -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 "✓ 已推送"