DEV Community

Eelco Verbrugge
Eelco Verbrugge

Posted on • Edited on

4

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.

PHPStorm->Git->Branches...->master->checkout

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

PHPStorm->Git->Pull...->Pull

3. Checkout your_feature_branch where you've made your changes

PHPStorm->Git->Branches...->your_feature_branch->checkout

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

PHPStorm->Git->Pull...->Pull

5. Merge master into your_feature_branch

PHPStorm->Git->Merge...->master

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!

PHPStorm->Git->Push...

Thats all folks~

Source:
jetbrains.com

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Engage with a sea of insights in this enlightening article, highly esteemed within the encouraging DEV Community. Programmers of every skill level are invited to participate and enrich our shared knowledge.

A simple "thank you" can uplift someone's spirits. Express your appreciation in the comments section!

On DEV, sharing knowledge smooths our journey and strengthens our community bonds. Found this useful? A brief thank you to the author can mean a lot.

Okay