{"id":5479,"date":"2024-11-21T06:48:42","date_gmt":"2024-11-21T06:48:42","guid":{"rendered":"https:\/\/ubiq.co\/tech-blog\/?p=5479"},"modified":"2025-05-23T07:23:45","modified_gmt":"2025-05-23T07:23:45","slug":"how-to-resolve-merge-conflicts-in-git","status":"publish","type":"post","link":"https:\/\/ubiq.co\/tech-blog\/how-to-resolve-merge-conflicts-in-git\/","title":{"rendered":"How to Resolve Merge Conflicts in Git"},"content":{"rendered":"\n<p>Git is a popular, open-source, distributed version control system that allows multiple software developers and teams to concurrently build applications and websites. Since it allows many people to work on the same code repository at the same time, it is possible that this results in merge conflicts, where different developers have updated the same piece of code or file. In fact, this is a common occurrence in git repositories. In this article, we will learn how to resolve merge conflicts in git. They can be applied to all platforms &#8211; mac, windows or linux.<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-resolve-merge-conflicts-in-git\/#What_is_Git_Merge_Conflict\" >What is Git Merge Conflict<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-resolve-merge-conflicts-in-git\/#Types_of_Git_Merge_Conflicts\" >Types of Git Merge Conflicts<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-resolve-merge-conflicts-in-git\/#1_Pending_Changes\" >1. Pending Changes<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-resolve-merge-conflicts-in-git\/#2_Conflicting_File_Contents\" >2. Conflicting File Contents<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-resolve-merge-conflicts-in-git\/#3_Conflicting_Files\" >3. Conflicting Files<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-resolve-merge-conflicts-in-git\/#Example_of_Merge_Conflict\" >Example of Merge Conflict<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-resolve-merge-conflicts-in-git\/#How_to_Resolve_Merge_Conflicts_in_Git\" >How to Resolve Merge Conflicts in Git<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-resolve-merge-conflicts-in-git\/#Resolving_File_Content_Conflicts\" >Resolving File Content Conflicts<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-resolve-merge-conflicts-in-git\/#Resolving_File_Merge_Conflicts\" >Resolving File Merge Conflicts<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-resolve-merge-conflicts-in-git\/#Git_Commands_to_Resolve_Merge_Conflicts\" >Git Commands to Resolve Merge Conflicts<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-resolve-merge-conflicts-in-git\/#1_git_log_%E2%80%93merge\" >1. git log &#8211;merge<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-resolve-merge-conflicts-in-git\/#2_git_diff\" >2. git diff<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-resolve-merge-conflicts-in-git\/#3_git_checkout\" >3. git checkout<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-14\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-resolve-merge-conflicts-in-git\/#4_git_stash\" >4. git stash<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-15\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-resolve-merge-conflicts-in-git\/#5_git_merge_%E2%80%93abort\" >5. git merge &#8211;abort<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-16\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-resolve-merge-conflicts-in-git\/#6_git_reset\" >6. git reset<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-17\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-resolve-merge-conflicts-in-git\/#FAQs\" >FAQs<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-18\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-resolve-merge-conflicts-in-git\/#Conclusion\" >Conclusion<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_is_Git_Merge_Conflict\"><\/span>What is Git Merge Conflict<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Merge conflicts occur if there are two commits with changes to the same lines of a file, or the same file. For example, if two developers working on different branches of same git repository, commit changes to the same lines of a file, then it may result in a merge conflict. Similarly, if one developer deletes a file on one branch, while the other developer commits changes to this file without deleting it, then also it will cause merge conflict. Git will automatically merge two commits only if the commits are pertaining to different lines of same file, or they are related to different files.<\/p>\n\n\n\n<p>Please note, these merge conflicts can happen whether these two commits belong to same or different branches. They can occur if you try to merge to local branches. They can even occur if you push a local commit to a remote branch, or pull a remote branch to local repository. The key point to remember is that a merge conflict happens between two commits and not branches. So it can occur wherever there is a requirement to combine two commits.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Types_of_Git_Merge_Conflicts\"><\/span>Types of Git Merge Conflicts<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>There are several places where git merge conflict can occur. Let us look at the most common use cases.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"1_Pending_Changes\"><\/span>1. Pending Changes<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>If there are pending changes that have not been committed in any of the commits that are being merged, it will result in a conflict, unless you commit those changes using &#8216;git commit&#8217; command or stash them using &#8216;git stash&#8217; command.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"2_Conflicting_File_Contents\"><\/span>2. Conflicting File Contents<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>If the same file has been modified in two separate commits, git will try to merge them as much as possible. But if the same lines of the file have been modified in both commits, then it will give a merge conflict. It will do this for all files where the same lines have been modified in two different commits. Nevertheless, git will merge all other files successfully.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"3_Conflicting_Files\"><\/span>3. Conflicting Files<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>In this case, one developer may edit a file and commit the changes in his\/her branch while another developer completely delete the file and commits the changes in his\/her branch. At the time of merging, git will not be able to determine whether to keep or delete the file and result in merge conflict.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Example_of_Merge_Conflict\"><\/span>Example of Merge Conflict<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Let us look at a simple case of merge conflict to help you understand what happens exactly.<\/p>\n\n\n\n<p>Let us initialize git repository called demo.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ git init demo<br>$ cd demo<\/pre>\n\n\n\n<p>Let us create a new branch b1 for this repository and checkout this new branch.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ git checkout -b b1<\/pre>\n\n\n\n<p>Let us create a new file test.txt in this branch.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ vi test.txt<\/pre>\n\n\n\n<p>Add some content to it (e.g. hello world), save &amp; close the file. Check the status of this file.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ git status<\/pre>\n\n\n\n<p>You will see the following line in red indicating that the a new file has been added to repository but it is not staged yet.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">modified: test.txt<\/pre>\n\n\n\n<p>Run the following command to stage it (start tracking changes to it).<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ git add .<\/pre>\n\n\n\n<p>Run the following command to commit the changes.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ git commit -am \"test commit\"<\/pre>\n\n\n\n<p>Create a new branch b2 and switch to it.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ git checkout -b b2<\/pre>\n\n\n\n<p>Create a new file with same file name test.txt and add the text &#8216;good morning&#8217; to it. Save and close the file.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ vi test.txt<\/pre>\n\n\n\n<p>Check the status of changes.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ git status<\/pre>\n\n\n\n<p>You will again see the following line in red indicating that the file is untracked.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">modified: test.txt<\/pre>\n\n\n\n<p>Add the file and commit the changes.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ git add .<br>$ git commit -am \"test changes 2\"<\/pre>\n\n\n\n<p>Now switch back to b1 and make some more changes to test.txt file, say, add &#8216;good bye&#8217; to it. Save and close the file. Commit those changes.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ git checkout b1<br>$ vi test.txt<br>$ git add .<br>$ git commit -am \"test commit\"<\/pre>\n\n\n\n<p>We are still working in branch b1. Now if you try to merge branch b2 to branch b1, you will get merge conflict.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ git merge b2<br>Auto-merging test.txt<br>CONFLICT (content): Merge conflict in test.txt<br>Automatic merge failed; fix conflicts and then commit the result.<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"How_to_Resolve_Merge_Conflicts_in_Git\"><\/span>How to Resolve Merge Conflicts in Git<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>There are two ways to resolve merge conflicts. Let us look at them one by one.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Resolving_File_Content_Conflicts\"><\/span>Resolving File Content Conflicts<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>If you modify the same lines of same file in different git branches and commit those changes, then you will get a merge conflict when you try to merge these two branches. You can fix this problem by creating a new commit before you merge these branches.<\/p>\n\n\n\n<p>Go to your repository and run git status to see the conflicting file. The part in bold clearly says there is a merge conflict that you need to fix.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ cd demo<br>$ git status<br>On branch b1<br>You have unmerged paths.<br><strong>  (fix conflicts and run \"git commit\")<\/strong><br>  (use \"git merge --abort\" to abort the merge)<br><br>Unmerged paths:<br>  (use \"git add &lt;file&gt;...\" to mark resolution)<br>        both modified:   test.txt<br><br>no changes added to commit (use \"git add\" and\/or \"git commit -a\")<\/pre>\n\n\n\n<p>Open the conflicting file in text editor.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ vi test.txt<\/pre>\n\n\n\n<p>You will see the following lines.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">&lt;&lt;&lt;&lt;&lt;&lt;&lt; HEAD<br>hello world<br>good bye<br>=======<br>good morning<br>&gt;&gt;&gt;&gt;&gt;&gt;&gt; b2<\/pre>\n\n\n\n<p>You will see conflict marker &lt;&lt;&lt;&lt;&lt;&lt; followed by HEAD meaning the present branch you are in, that is, b1. This is followed by the conflicting changes made in that branch b1. Then you will see the separator ======= that separates changes in b1 with those in b2. This is followed by conflicting changes in b2 followed by merge conflict marker &gt;&gt;&gt;&gt;&gt;&gt;&gt; followed by branch name b2. Non conflicting changes are left untouched.<\/p>\n\n\n\n<p>You need to decide whether to keep the version of b1 or b2 or a combination of the two or completely different content altogether at that place. Remove conflict markers &lt;&lt;&lt;&lt;&lt;&lt;&lt;, =======, &gt;&gt;&gt;&gt;&gt;&gt;&gt;. Save and close the file. We have chosen to combine changes from both b1 and b2.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">hello world<br>good bye<br>good morning<\/pre>\n\n\n\n<p>Add the file once again to your staging area.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ git add .<\/pre>\n\n\n\n<p>Commit changes.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ git commit -m 'resolved merge conflict'<\/pre>\n\n\n\n<p>This will produce the merged commit.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Resolving_File_Merge_Conflicts\"><\/span>Resolving File Merge Conflicts<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>This kind of conflict occurs if one developer deletes a file in one branch, commits changes and another developers edits the file in another branch, and commits changes. In this case, you will have to decide whether to keep or delete the file. Let us say one developer deletes test.txt file in b1 and another developer edits test.txt in b2 and commits those changes.<\/p>\n\n\n\n<p>To keep the file, use the following command.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ git add test.txt<\/pre>\n\n\n\n<p>To remove the file, use git rm command.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ git rm text.txt<\/pre>\n\n\n\n<p>Lastly, commit the changes to resolve merge conflict and created merged commit.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ git -m 'resolved merge conflict'<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Git_Commands_to_Resolve_Merge_Conflicts\"><\/span>Git Commands to Resolve Merge Conflicts<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>You can use the following commands to quickly identify the conflicting areas of code and fix them easily.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"1_git_log_%E2%80%93merge\"><\/span>1. git log &#8211;merge<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>git log command show commit logs. If you provide &#8211;merge option to it, then it will list only those commits where merge conflict has occured.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"2_git_diff\"><\/span>2. git diff<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>git diff command helps you to identify the differences between two files or repositories.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"3_git_checkout\"><\/span>3. git checkout<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>git checkout command is used to switch branches, or undo file changes<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"4_git_stash\"><\/span>4. git stash<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>git stash is used to stash all uncommitted changes<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"5_git_merge_%E2%80%93abort\"><\/span>5. git merge &#8211;abort<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>This command helps you completely abort git merge and restore the state before merging started.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"6_git_reset\"><\/span>6. git reset<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>git reset command will help you undo changes in conflicting files and restore them to their original state.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"FAQs\"><\/span>FAQs<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Here are some commonly asked questions about git merge.<\/p>\n\n\n\n<p><strong>1. How to avoid merge conflicts?<\/strong><\/p>\n\n\n\n<p>Make sure your developers work in isolated branches and there is proper communication when they are working on common files. Also, while working with local copies of remote repositories, use &#8216;git pull&#8217; command before you push any changes to remote repository. Also, follow <a href=\"https:\/\/ubiq.co\/tech-blog\/git-best-practices-tips-tricks\/\">git best practices and tricks<\/a>.<\/p>\n\n\n\n<p><strong>2. Do changes made to same file always cause merge conflict?<\/strong><\/p>\n\n\n\n<p>No. If different developers make changes to different parts of the same file, then there will not be any conflict. However, if they edit the same parts of the file, then there may be conflict. If the commit sequence is such that git is able to resolve the changes, then also there will not be any conflict.<\/p>\n\n\n\n<p><strong>3. Are there any merge tools to directly resolve merge conflicts?<\/strong><\/p>\n\n\n\n<p>There are certain merge tools such as Meld or KDiff3 or &#8216;git mergetool&#8217; that provide a GUI representation of merge conflicts. But in all cases, you need to manually resolve the merge conflict. If it was automatically possible to resolve the conflict, &#8216;git merge&#8217; would have done it already. It shows the merge conflict error because it is unable to do so.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span>Conclusion<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>In this article, we have learnt what is git merge conflict, why it occurs, and different types of conflicts. We have also learnt different ways to resolve merge conflicts in git. We have also seen a simple example to demonstrate merge conflict and steps to resolve them. Unfortunately, all merge conflicts have to be manually resolved. There is no way around it. All the git commands only help you quickly identify merge conflicts and verify if your steps have resolved them. If you encounter merge conflict in your software development project, you can use these steps to resolve them as per your requirement.<\/p>\n\n\n\n<p>Also read:<\/p>\n\n\n\n<p><a href=\"https:\/\/ubiq.co\/tech-blog\/how-to-execute-system-command-in-python\/\">How to Execute System Command in Python<\/a><br><a href=\"https:\/\/ubiq.co\/tech-blog\/how-javascript-closures-work\/\">How to JavaScript Closures Work<\/a><br><a href=\"https:\/\/ubiq.co\/tech-blog\/how-to-see-foreign-keys-related-to-table-or-column\/\">How to See Foreign Keys in MySQL<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Often software developers encounter merge conflicts in git while committing changes. Here is how to resolve merge conflicts in Git.<\/p>\n","protected":false},"author":1,"featured_media":5509,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[334],"tags":[335],"class_list":["post-5479","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-git","tag-merge-conflict"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Resolve Merge Conflicts in Git - Ubiq BI<\/title>\n<meta name=\"description\" content=\"Often software developers encounter merge conflicts in git while committing changes. Here is how to resolve merge conflicts in Git.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-resolve-merge-conflicts-in-git\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Resolve Merge Conflicts in Git - Ubiq BI\" \/>\n<meta property=\"og:description\" content=\"Often software developers encounter merge conflicts in git while committing changes. Here is how to resolve merge conflicts in Git.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/ubiq.co\/tech-blog\/how-to-resolve-merge-conflicts-in-git\/\" \/>\n<meta property=\"og:site_name\" content=\"Ubiq BI\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/ubiqbi\" \/>\n<meta property=\"article:published_time\" content=\"2024-11-21T06:48:42+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-05-23T07:23:45+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/ubiq.co\/tech-blog\/wp-content\/uploads\/2024\/11\/resolve-merge-conflict.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"300\" \/>\n\t<meta property=\"og:image:height\" content=\"201\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Sreeram Sreenivasan\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@UbiqBI\" \/>\n<meta name=\"twitter:site\" content=\"@UbiqBI\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Sreeram Sreenivasan\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-resolve-merge-conflicts-in-git\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-resolve-merge-conflicts-in-git\\\/\"},\"author\":{\"name\":\"Sreeram Sreenivasan\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/#\\\/schema\\\/person\\\/db98d49a766a3a111d8510935ab90abc\"},\"headline\":\"How to Resolve Merge Conflicts in Git\",\"datePublished\":\"2024-11-21T06:48:42+00:00\",\"dateModified\":\"2025-05-23T07:23:45+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-resolve-merge-conflicts-in-git\\\/\"},\"wordCount\":1547,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-resolve-merge-conflicts-in-git\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/ubiq.co\\\/tech-blog\\\/wp-content\\\/uploads\\\/2024\\\/11\\\/resolve-merge-conflict.jpg?fit=300%2C201&ssl=1\",\"keywords\":[\"merge conflict\"],\"articleSection\":[\"Git\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-resolve-merge-conflicts-in-git\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-resolve-merge-conflicts-in-git\\\/\",\"url\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-resolve-merge-conflicts-in-git\\\/\",\"name\":\"How to Resolve Merge Conflicts in Git - Ubiq BI\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-resolve-merge-conflicts-in-git\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-resolve-merge-conflicts-in-git\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/ubiq.co\\\/tech-blog\\\/wp-content\\\/uploads\\\/2024\\\/11\\\/resolve-merge-conflict.jpg?fit=300%2C201&ssl=1\",\"datePublished\":\"2024-11-21T06:48:42+00:00\",\"dateModified\":\"2025-05-23T07:23:45+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/#\\\/schema\\\/person\\\/db98d49a766a3a111d8510935ab90abc\"},\"description\":\"Often software developers encounter merge conflicts in git while committing changes. Here is how to resolve merge conflicts in Git.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-resolve-merge-conflicts-in-git\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-resolve-merge-conflicts-in-git\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-resolve-merge-conflicts-in-git\\\/#primaryimage\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/ubiq.co\\\/tech-blog\\\/wp-content\\\/uploads\\\/2024\\\/11\\\/resolve-merge-conflict.jpg?fit=300%2C201&ssl=1\",\"contentUrl\":\"https:\\\/\\\/i0.wp.com\\\/ubiq.co\\\/tech-blog\\\/wp-content\\\/uploads\\\/2024\\\/11\\\/resolve-merge-conflict.jpg?fit=300%2C201&ssl=1\",\"width\":300,\"height\":201,\"caption\":\"resolve merge conflict in git\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-resolve-merge-conflicts-in-git\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Resolve Merge Conflicts in Git\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/#website\",\"url\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/\",\"name\":\"Ubiq BI\",\"description\":\"Build dashboards &amp; reports in minutes\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/#\\\/schema\\\/person\\\/db98d49a766a3a111d8510935ab90abc\",\"name\":\"Sreeram Sreenivasan\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g\",\"caption\":\"Sreeram Sreenivasan\"},\"description\":\"Sreeram Sreenivasan is the Founder of Ubiq. He has helped many Fortune 500 companies in the areas of BI &amp; software development.\",\"sameAs\":[\"https:\\\/\\\/www.linkedin.com\\\/in\\\/sreeram-sreenivasan\\\/\"],\"url\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/author\\\/wordpress\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Resolve Merge Conflicts in Git - Ubiq BI","description":"Often software developers encounter merge conflicts in git while committing changes. Here is how to resolve merge conflicts in Git.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/ubiq.co\/tech-blog\/how-to-resolve-merge-conflicts-in-git\/","og_locale":"en_US","og_type":"article","og_title":"How to Resolve Merge Conflicts in Git - Ubiq BI","og_description":"Often software developers encounter merge conflicts in git while committing changes. Here is how to resolve merge conflicts in Git.","og_url":"https:\/\/ubiq.co\/tech-blog\/how-to-resolve-merge-conflicts-in-git\/","og_site_name":"Ubiq BI","article_publisher":"https:\/\/www.facebook.com\/ubiqbi","article_published_time":"2024-11-21T06:48:42+00:00","article_modified_time":"2025-05-23T07:23:45+00:00","og_image":[{"width":300,"height":201,"url":"https:\/\/ubiq.co\/tech-blog\/wp-content\/uploads\/2024\/11\/resolve-merge-conflict.jpg","type":"image\/jpeg"}],"author":"Sreeram Sreenivasan","twitter_card":"summary_large_image","twitter_creator":"@UbiqBI","twitter_site":"@UbiqBI","twitter_misc":{"Written by":"Sreeram Sreenivasan","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/ubiq.co\/tech-blog\/how-to-resolve-merge-conflicts-in-git\/#article","isPartOf":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-resolve-merge-conflicts-in-git\/"},"author":{"name":"Sreeram Sreenivasan","@id":"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc"},"headline":"How to Resolve Merge Conflicts in Git","datePublished":"2024-11-21T06:48:42+00:00","dateModified":"2025-05-23T07:23:45+00:00","mainEntityOfPage":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-resolve-merge-conflicts-in-git\/"},"wordCount":1547,"commentCount":0,"image":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-resolve-merge-conflicts-in-git\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2024\/11\/resolve-merge-conflict.jpg?fit=300%2C201&ssl=1","keywords":["merge conflict"],"articleSection":["Git"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/ubiq.co\/tech-blog\/how-to-resolve-merge-conflicts-in-git\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/ubiq.co\/tech-blog\/how-to-resolve-merge-conflicts-in-git\/","url":"https:\/\/ubiq.co\/tech-blog\/how-to-resolve-merge-conflicts-in-git\/","name":"How to Resolve Merge Conflicts in Git - Ubiq BI","isPartOf":{"@id":"https:\/\/ubiq.co\/tech-blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-resolve-merge-conflicts-in-git\/#primaryimage"},"image":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-resolve-merge-conflicts-in-git\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2024\/11\/resolve-merge-conflict.jpg?fit=300%2C201&ssl=1","datePublished":"2024-11-21T06:48:42+00:00","dateModified":"2025-05-23T07:23:45+00:00","author":{"@id":"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc"},"description":"Often software developers encounter merge conflicts in git while committing changes. Here is how to resolve merge conflicts in Git.","breadcrumb":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-resolve-merge-conflicts-in-git\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/ubiq.co\/tech-blog\/how-to-resolve-merge-conflicts-in-git\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ubiq.co\/tech-blog\/how-to-resolve-merge-conflicts-in-git\/#primaryimage","url":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2024\/11\/resolve-merge-conflict.jpg?fit=300%2C201&ssl=1","contentUrl":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2024\/11\/resolve-merge-conflict.jpg?fit=300%2C201&ssl=1","width":300,"height":201,"caption":"resolve merge conflict in git"},{"@type":"BreadcrumbList","@id":"https:\/\/ubiq.co\/tech-blog\/how-to-resolve-merge-conflicts-in-git\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/ubiq.co\/tech-blog\/"},{"@type":"ListItem","position":2,"name":"How to Resolve Merge Conflicts in Git"}]},{"@type":"WebSite","@id":"https:\/\/ubiq.co\/tech-blog\/#website","url":"https:\/\/ubiq.co\/tech-blog\/","name":"Ubiq BI","description":"Build dashboards &amp; reports in minutes","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/ubiq.co\/tech-blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc","name":"Sreeram Sreenivasan","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g","caption":"Sreeram Sreenivasan"},"description":"Sreeram Sreenivasan is the Founder of Ubiq. He has helped many Fortune 500 companies in the areas of BI &amp; software development.","sameAs":["https:\/\/www.linkedin.com\/in\/sreeram-sreenivasan\/"],"url":"https:\/\/ubiq.co\/tech-blog\/author\/wordpress\/"}]}},"jetpack_featured_media_url":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2024\/11\/resolve-merge-conflict.jpg?fit=300%2C201&ssl=1","jetpack_shortlink":"https:\/\/wp.me\/pbGGTT-1qn","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts\/5479","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/comments?post=5479"}],"version-history":[{"count":41,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts\/5479\/revisions"}],"predecessor-version":[{"id":8351,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts\/5479\/revisions\/8351"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/media\/5509"}],"wp:attachment":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/media?parent=5479"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/categories?post=5479"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/tags?post=5479"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}