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?

【Git】PRレビュー待ち中に別タスクを安全に進める方法(stash / ブランチ運用)

0
Posted at

想定シーン

featureブランチで開発

PR作成済み

レビュー待ち中

でも別タスクが発生した

どう動くのが正解?

結論

原則

PRブランチは触らない。mainから新ブランチを切る。

🟢 パターン①:PRは出していて、作業は完了済み

手順

# mainへ戻る
git checkout main

# 最新化
git pull origin main

# 新しいブランチを作成
git checkout -b feature/next-task

これだけでOK。

ポイント

▪️PRブランチはそのまま維持

▪️レビュー修正が来たら戻る

git checkout feature/old-branch

🟡 パターン②:作業途中で急ぎ別タスクが来た

① 作業内容を一時保存

変更内容が退避される。

git stash

② mainへ戻って新ブランチ作成

git checkout main
git pull
git checkout -b feature/urgent-task

③ 元の作業に戻るとき

変更内容が復元される。

git checkout feature/original-branch
git stash pop
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?