コンフリクトした際の対応
上の方は、コンフリクトしているファイルを別名でブランチを切る手順です。 コンフリクトファイルのみを消したい場合は、半ばくらいから参考にして下さい。
コンフリクトファイルだけ別ブランチで切る手順
1. コンフリクトしている部分(ExceptionクラスとException.xml)のみを一度デスクトップ等のどこかに保存
この時に、コンフリクトのファイルパスもどこかにコピー
2. コンフリクトしているファイル名(今回の場合はExceptionクラス)の名前で新しくブランチを作成する
$ git checkout -b <ブランチ名> Origin/develop 3. 一度保存したコンフリクトファイルを、ファイルパスを元に元の階層に戻す
4. git上にステージングし、コミット、pull request
git add <ファイルパス> git commit -m <コメント> git push nm <ブランチ名> 5. git上でpull request
コンフリクトファイルの消去手順
1. コンフリクトしているブランチへcheckout
$ git checkout <コンフリクトブランチ名> 2. gitのcommit履歴を出す
$ git log --oneline --name-status --graph 3. ブランチ切った時のIDをメモ
4. コミット履歴を消す
$ git reset <コミットID> (※心配な方は、予め別名でブランチを作っておく) (本番ブランチの名前を変更するコマンド) $ git branch -m <本番ブランチ> <別名ブランチ> (再び本番ブランチ名でブランチを作成) $ git checkout -b <本番ブランチ> Origin/develop (この場合、developからのブランチの為、ファイルを再配置する必要がある)
5. Origin/developを更新(一応)
$ git fetch --all--prune $ git rebase origin/develop 6. 再びgit上にステージング、commit、push
(※この時にpull request時に-fコマンドで強制的にpull requestをする!!)
$ git add <ファイルパス> $ git commit -m <コメント> (git statusで変更履歴が見れる) modified: <コンフリクトファイルパス> とか出る。コンフリクトファイルパス>
$ git push -f nm <ブランチ名> This post is licensed under CC BY 4.0 by the author.