Initial commit

This commit is contained in:
Zhongwei Li
2025-11-29 18:23:35 +08:00
commit 0fe2638c61
150 changed files with 37511 additions and 0 deletions

38
commands/push-current.md Normal file
View File

@@ -0,0 +1,38 @@
# Git Push Current Branch
現在のブランチをリモートにpushするカスタムコマンド
```bash
# 現在のブランチ名を取得
CURRENT_BRANCH=$(git branch --show-current)
if [ -z "$CURRENT_BRANCH" ]; then
echo "Error: ブランチ名を取得できませんでした"
exit 1
fi
echo "現在のブランチ: $CURRENT_BRANCH"
# メインブランチのチェック
if [ "$CURRENT_BRANCH" = "main" ] || [ "$CURRENT_BRANCH" = "master" ]; then
echo "❌ Error: メインブランチ ($CURRENT_BRANCH) への直接pushは禁止されています"
echo "フィーチャーブランチを作成してください"
exit 1
fi
# リモートブランチの存在確認
if git ls-remote --heads origin "$CURRENT_BRANCH" | grep -q "$CURRENT_BRANCH"; then
echo "リモートブランチが存在します。pushを実行..."
git push origin "$CURRENT_BRANCH"
else
echo "リモートにブランチが存在しません。upstream設定付きでpushを実行..."
git push -u origin "$CURRENT_BRANCH"
fi
if [ $? -eq 0 ]; then
echo "✅ push完了: $CURRENT_BRANCH"
else
echo "❌ pushに失敗しました"
exit 1
fi
```