Recently at work, we've switched from using SVN to using git. We have to maintain multiple versions of our software, and we had them setup as branches before. So after using git svn clone
, we ended up with 4 branches: master, 5.0, 5.1, and 5.2.
Note: We use master as our development branch. 5.0, 5.1, and 5.2 all branch from master and are used as production branches.
A few days have gone by and quite a few changes have gone into master. A bug was just found in 5.2 and we want to fix it. We've tried the the solution from Merging one change to multiple branches in Git with partial luck. We can always merge back into master easily, but whenever we merge back into 5.2 we get a bunch of conflicts. Everything we've seen that shows this process (creating a new branch for bugfix and merging it back into development and production) shows that it should be as simple as:
(master)$ git checkout -b bugfix
# fixed bug and committed
(bugfix)$ git checkout master
(master)$ git merge bugfix
# successful merge
(master)$ git checkout 5.2
(5.2)$ git merge bugfix
# successful merge
However for us when we get to that final line git merge bugfix
we get tons and tons of conflicts. Conflicts for files that we haven't even touched in the bugfix. What are we doing wrong?
Note: We have also tried doing this process by starting the bugfix branch from 5.2. Then merging the bugfix into 5.2 is easy but merging the bugfix into master generates the conflicts.
Other places that show the process:
- http://nvie.com/posts/a-successful-git-branching-model/#hotfix-branches
- https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow (scroll to "End-user discovers a bug")