Solve merge conflicts with PHPStorm

Once in a while a merge conflict popups. This happens when you’ve created your branch … Read more 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. 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.

PHPStorm->Git->Branches…->master
or Ctrl+Shift+`



2. Pull the latest changes to your local machine

PHPStorm->Git->Pull…



3. Checkout your_feature_branch where you’ve made your changes

PHPStorm->Git->Branches…->your_feature_branch
or Ctrl+Shift+`



4. Merge master into your_feature_branch

PHPStorm->Git->Merge…->master



5. Resolve Conflicts

PHPStorm->Git->Resolve Conflicts

Choose Merge.
alt text

Accept or refuse solutions on the right or left.
alt text

Apply if done.



6. Git commit your changes

PHPStorm->Git->Commit->your_file->Commit
or Ctrl+K



7. Git push and celebrate life!

PHPStorm->Git->Push…
or Ctrl+Shift+K

Git will generate a comment for your commit such as “Merge branch ‘master’ into your_feature_branche”

Thats all folks~

Source:
jetbrains.com

Source: DEV Community


Categories: NewsTags: , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *