Today I needed to take my model git branch which was based off of the develop branch a week ago, and rebase it off of the master. First I did the obvious,
git rebase master in my model branch, that yielded tons of conflicts. The conflicts were a result of commits in the develop branch being squashed when they got merged to master to keep the history clean. Instead of fixing tons of conflicts, I simply chose to take my 3 commits and create patches from them:
git format-patch -3 HEAD
I created a new branch off of
master and applied my patches using
git checkout master git checkout -b model_updates git am ~/0001-add-rhev-params-remove-serialized-hash.patch git am ~/0002-start-v21-of-deployments.patch git am ~/0003-rename-columns-and-include-missing-columns.patch
Patch 0001 and ultimately 0003 applied without problems. Patch 0002 on the other hand gave me fits, I expected it, but I refused to recode the change.
git am ... just fails when it hits a conflict. Using the trusty Google, I found this blog: Deal with git am failures. I followed the instructions from that blog post:
git am --abort #abort the previously failed 0002 patch run git apply ~/0002-start-v21-of-deployments.patch --reject # yield .rej files I could inspect git add server/app/controllers/fusor/api/v2/deployments_controller.rb # ensure changes are fine git add server/app/controllers/fusor/api/v21/ # new files from patch git am --resolved # tells git we're good to go, proceed.
Done! Way easier than dealing with the conflicts from the rebase. Easier than trying to recode the patch as well.