LoginSignup
0
0

More than 1 year has passed since last update.

git rebase でコンフリクトした場合の解消手順

Posted at

この記事が役立つ状況

  • 作業ブランチは、pushしていない
  • 作業ブランチで git rebase develop をしたらコンフリクトした

rebaseの手順

作業ブランチは、(work)であるものとする。

  1. 作業ブランチに未コミットの修正がない状態にする
    1. git add -A
    2. git commit -m "comment"
      1. コミットする粒度ではない場合 git stash
  2. develop(rebase先)を最新にする
    1. git checkout develop
    2. git pull
  3. rebaseする
    1. git checkout work
    2. git rebase develop
    3. ここで、コンフリクトしてしまい、警告が出たものとする
  4. コンフリクトしたファイルを確認する
    (警告メッセージを読めば書いてあるが、gitbashだと色が付くのでこちらの方がわかりやすい)
    1. git status
    2. both modified: xxx.xxx を探す
  5. コンフリクトを解消する
    1. xxx.xxx を修正する
    2. git add xxx.xxx
  6. rebaseを完了させる
    1. git rebase --continue
    2. (stashしていた場合のみ)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