fix: 优化了代码
This commit is contained in:
22
g.sh
Executable file
22
g.sh
Executable 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 "✓ 已推送"
|
||||
Reference in New Issue
Block a user