Gitでrebaseが停止している状態の確認方法
rebaseでコンフリクトが発生した場合にどんな状態になっているか確認する方法
状態の確認
status で以下が分かる
rebase完了コミット
rebaseで停止しているコミット
コンフリクト対象ファイル
code: (sh)
❯ git status
interactive rebase in progress; onto 6cc8d98fd # リベースの元になるコミット(作業ブランチ)
Last commands done (3 commands done): # rebase完了コミット
pick 425ec601b /training以外で法人利用の文言が使用されている箇所を企業研修代行に修正
pick fdb12597e 企業研修代行にタイトルを変えたことによる、全体の文章の調整 # ここで止まっている(コンフリクトしているコミット)
(see more in file .git/rebase-merge/done)
Next commands to do (26 remaining commands):
pick 68a73f728 CIがrerunできなくなったので、強制的にrerunするためのpush
pick 1dc6d2cd5 CircleCIのre-runが実行できないため、空のコミットをプッシュし強制的に実行
(use "git rebase --edit-todo" to view and edit)
You are currently rebasing branch 'feature/display_FAQ_bottom_of_/job_support' on '6cc8d98fd'.
(fix conflicts and then run "git rebase --continue")
(use "git rebase --skip" to skip this patch)
(use "git rebase --abort" to check out the original branch)
Changes to be committed:
...
Unmerged paths:
(use "git restore --staged <file>..." to unstage)
(use "git add <file>..." to mark resolution)
both modified: app/controllers/welcome_controller.rb # コンフリクト対象ファイル
both modified: db/fixtures/faqs.yml # コンフリクト対象ファイル
...
rebase完了のコミット確認
.git/rebase-merge/done にrebase完了コミットが並ぶ
code:_
❯ cat .git/rebase-merge/done
1 pick 689f28d37b38fe72c40fdfcaf1e52a2bbdca5720 /training以下で表示される法人利用の文言を企業研修代行に修正
2 pick 425ec601bbb23dd662abfe1f85dbe52ab98296fa /training以外で法人利用の文言が使用されている箇所を企業研修代行に修正
# 以下コミットでコンフリクトしてrebaseが停止している
3 pick fdb12597ed37b418f98a43958b4559b8da31e495 企業研修代行にタイトルを変えたことによる、全体の文章の調整
コンフリクトしているコミットの確認
.git/rebase-merge/done で確認できたコンフリクトしているコミットIDを元にコミットの内容を確認できる
code: (sh)
git show コンフリクトしているコミットID -- コンフリクトしているファイル名
例) コミットID: fdb12597e、対象ファイル: db/fixtures/faqs.yml
code: (sh)
❯ git show fdb12597e -- db/fixtures/faqs.yml
commit fdb12597ed37b418f98a43958b4559b8da31e495
Author: machida <machida@fjord.jp>
Date: Fri Jun 27 16:14:38 2025 +0900
企業研修代行にタイトルを変えたことによる、全体の文章の調整
diff --git a/db/fixtures/faqs.yml b/db/fixtures/faqs.yml
index 4024cf38a..2f98f5bf3 100644
--- a/db/fixtures/faqs.yml
+++ b/db/fixtures/faqs.yml