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?

PRを出したブランチとmainブランチとのコンフリクトを解決する

Posted at

はじめに

つい最近PRを作成したときに、mainブランチとのコンフリクトが起きていたのですが、解決方法に少々苦しんだので共有しときます。

問題

リモートのmainブランチを取り込もうと以下のコマンドを実行したところエラーが発生して処理できなかったです。

git pull origin maim

解決策

以下のコマンドを実行する。※作業したいブランチで

  1. 最新の更新をoriginに持ってくる
    git fetch
    
  2. 作業ブランチにマージする
    git merge origin/main
    
  3. リモートに変更を上げる
    git push
    

このあとエディタに飛ばされるかもですが、Exit(Ctrl + x)してEnterすると行けます(デフォルトのコミットメッセージなので編集したければここで)。

参考

  • この記事に助けられました。本当にありがとうございます

終わりに

正直原因は完璧に理解していないところが個人的にももやもやしてます。でも、今回の場合コンフリクトが起きているとpullのコマンドがうまく実行できないらしいです。マージの段階で自動的に終了させられているっぽいかなー。

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?