Last active
September 26, 2024 07:58
-
-
Save MizoTake/efb9f7594f883f2fa759f9cc298a9183 to your computer and use it in GitHub Desktop.
cherry-picks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # チェリーピックするコミットハッシュを格納したファイル | |
| commit_file="commits.txt" | |
| # ファイルが存在するかチェック | |
| if [ ! -f "$commit_file" ]; then | |
| echo "Commit file not found: $commit_file" | |
| exit 1 | |
| fi | |
| # コミットハッシュごとにループしてチェリーピック | |
| while IFS= read -r commit_hash | |
| do | |
| # コミットハッシュから改行や空白を取り除く | |
| commit_hash=$(echo "$commit_hash" | tr -d '\n\r' | xargs) | |
| # 空行を無視 | |
| if [ -z "$commit_hash" ]; then | |
| continue | |
| fi | |
| echo "Cherry-picking commit: $commit_hash" | |
| git cherry-pick "$commit_hash" | |
| # チェリーピックが失敗した場合、処理を中断 | |
| if [ $? -ne 0 ]; then | |
| echo "Cherry-pick failed for commit: $commit_hash" | |
| exit 1 | |
| fi | |
| done < "$commit_file" | |
| echo "All commits cherry-picked successfully." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // commit hash |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment