Monday, November 7, 2016

Git simple merge conflict resolution

I was trying to merge something from feature/sonar_fixes to dev, but dev had changes from someone else. This is what I had to do to resolve conflicts:

Step 1: Fetch the changes (saving the target branch as FETCH_HEAD).

git fetch origin dev

Step 2: Checkout the source branch and merge in the changes from the target branch. Resolve conflicts.

git checkout feature/sonar_fixes
git merge FETCH_HEAD

Thar be merge conflicts here: Open the files and look for FETCH_HEAD

Step 3: After the merge conflicts are resolved, stage the changes accordingly, commit the changes and push.

git add <file name with conflicts>
git commit
git push origin HEAD

No comments:

Post a Comment