git pull とかでコンフリクトが起こったときの対処
git pull は自動でマージをしてくれますが、たまに解決できないコンフリクト(衝突)の問題があるそうで
それの修正の仕方は、問題のあったファイルに詳しく書いてあります
gituser@gitrepo:~/git-dir/mysite$ git pull mysite-remote master remoteuser@192.168.0.112's password: #SSH login Auto-merged templates/myapp/res_list.html CONFLICT (content): Merge conflict in templates/myapp/res_list.html Automatic merge failed; fix conflicts and then commit the result. sano@ubuntu-vm:~/git-dir/mysite$ git status templates/myapp/res_list.html: needs merge ...
となったら、Mergeできなかった myapp/res_list.htmlをみます(リモート側じゃないよ)
すると、うまくマージできなかった部分に
<<<<<<< HEAD:templates/myapp/res_list.html <dt id="textbody">{{ object.textbody|linebreaks }}</dt> // これが比較前 ======= <dt id="textbody">{{ object.textbody|linebreaksbr }}</dt> //リモート側(2行) <div id="tagblock"> >>>>>>> 656256af16ad5e4da14490a70d25eb4e415fca60:templates/myapp/res_list.html
のように、マージできなかった部分の比較があります。どちらにするか決めて修正(gitが編集した部分も取り除く)
そうして、
gituser@gitrepo:~/git-dir/mysite$ git commit -a -m"update merge" Created commit d4a18ee: update merge
のように修正してcommitしてあげれば、リモートからのマージの結果も適応されるわけです。
今までなんでマージできないのか疑問でしたが、ようやく解決!