0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

複数ブランチを一括コミットしたいときの自分用シェル

Posted at

複数ブランチを一括コミットしたいときの自分用シェル

#!/bin/bash

# 二次元配列: プロジェクト名と対応する番号
projects=(
    "プロジェクトA 3"
    "プロジェクトB 6"
    "プロジェクトC 11"
)

# プロジェクトごとに処理
for project in "${projects[@]}"; do
    # プロジェクト名と番号を分割
    IFS=' ' read -r -a project_info <<< "$project"
    project_name="${project_info[0]}"
    project_number="${project_info[1]}"

    # ディレクトリに移動
    cd "/c/src/$project_name" || exit

    # ブランチ名とコミットメッセージを作成
    branch_name="feature_${project_number}_hogehoge"
    commit_message="テスト #${project_number}"

    # Gitコマンドを実行
    git checkout -b "$branch_name"
    git add .
    git commit -m "$commit_message"
    git push origin "$branch_name"
done

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?