Sitemap

Git Merging Branches (with Conflicts)

Mar 1, 2022

Master Branch — master
Feature C— feature-c (branch which will have the conflict with master)

List down the available branches

git branch -a

Checkout the master branch

git checkout master

Merge the feature-c for the master

git merge feature-c

<MERGE CONFLICT ERRORS SHOULD LIST IN THE TERMINAL>

Press enter or click to view image in full size

Go to the each of files and resolve each conflict manually.

After manually fixing all the conflicts, add the changes to git.

git add .
git commit (← without any commit comment as merging automatically adds)

Linux/Unix terminal will open-up. Just press “SHIFT + :” and enter “wq”.

Unix terminal will exit and merging message will display in git-terminal

Check for the git log for the commit;

git log — oneline

After the merge, if you wanna create a new branch from the master;
git checkout -b feature-c-new

--

--

Hirosh Tharaka
Hirosh Tharaka

Written by Hirosh Tharaka

BSc(Hons), CSM®, ISTQB® (CTFL, CTAL-TTA, CTAL-TM) | Technical Writer | Technical Tester (QA Lead)

No responses yet