DEV Community

Eelco Verbrugge
Eelco Verbrugge

Posted on • Updated on

Solve merge conflicts with PHPStorm

Once in a while a merge conflict popups. This happens when you've created your branch and in the meantime your colleague pushed changes just before you did on the same line. Git (or your colleague) will let you know if it can be solved automatically and if not, it's up to you how to fix it.

How to fix merge conflicts with PHPStorm?

1. Checkout the branch where you want to merge to. For example the master branch.


2. Pull the latest changes to your local machine from master


3. Checkout your_feature_branch where you've made your changes


4. Also pull the latest changes to your local machine from your branch, just to be sure


5. Merge master into your_feature_branch


6. Resolve Conflicts

PHPStorm will automatically open this Conflict window if there is a conflict detected:

alt text

Choose Merge.

7. Accept or refuse solutions on the right or left.

alt text

Apply if done.

7. Git commit your changes

PHPStorm will automatically commit these changes if you Apply. Git will generate a comment for your commit such as "Merge branch 'development' into your_feature_branche"

8. Git push and celebrate life!


Thats all folks~


Top comments (0)