{"id":53344,"date":"2018-01-03T11:00:42","date_gmt":"2018-01-03T09:00:42","guid":{"rendered":"http:\/\/examples.javacodegeeks.com\/?p=53344"},"modified":"2019-04-23T14:22:30","modified_gmt":"2019-04-23T11:22:30","slug":"git-mergetool-example","status":"publish","type":"post","link":"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-mergetool-example\/","title":{"rendered":"Git Mergetool Example"},"content":{"rendered":"<p>Merge Conflicts are undesirable for most of the developers for various reasons. No matter how careful and collaborative developers are, they often end up in merge conflicts. There are multiple ways to resolve merge conflicts, and each developer prefers a different way. Compared to other version control systems like SVN, CVS etc, resolving conflicts with Git is much easier. Though Git tries to be smart in resolving merge conflicts, there are some cases where it does not overdo stuff and lets developer decide which code needs to be merged.&nbsp;This article explains how to resolve merge conflicts using <code>git mergetool<\/code>.<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;\n<\/p>\n<h2>1. Introduction<\/h2>\n<p>The <code>git mergetool<\/code> helps the developer to resolve conflicts in an efficient way. It provides a GUI where you can look at versions from your current branch, remote branch, common ancestor and final merged version, all in one window, which we will see going further into the article.<\/p>\n<p>In this example, we will walk you through how <code>git mergetool<\/code> can be of great help while resolving conflicts. We will start with a scenario that will create a conflict situation. Then we will explain how the conflict can be resolved with <code>git mergetool<\/code> using vmdiff editor.&nbsp; We will then explain few useful commands and various options to configure a mergetool of your choice. Finally, we will show you how mergetool can be used with kdiff3.<\/p>\n<h2>2. Tools used<\/h2>\n<ul>\n<li>Git 2.7.0.2<\/li>\n<li>KDiff3 0.9.98 (64 bit)<\/li>\n<li>Windows 7<\/li>\n<\/ul>\n<h2>3. Conflict scenario<\/h2>\n<p>This section describes a scenario that will run you into a conflict so that we can use <code>git mergetool<\/code> to resolve it.<\/p>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li>Invoke Git Bash.<\/li>\n<li>Create a directory in your local computer, and navigate to the same. (mergetool_demo)<\/li>\n<li>Create an empty Git repository under this directory.&nbsp;You will be on &#8216;master&#8217; at this point.<\/li>\n<li>Create a new file &#8216;myfile.txt&#8217;.<\/li>\n<li>Add a new line to the file -&gt; &#8216;First Commit.&#8217;<\/li>\n<li>Add the file to staging area, then commit it. Now you have committed the changes to &#8216;myfile.txt&#8217; to &#8216;master&#8217;.<\/li>\n<li>Create a new branch &#8216;mybranch&#8217;, and switch to it. The&nbsp;below command creates a new branch named &#8216;mybranch&#8217; and switches to it in one step.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<pre class=\"brush:bash\">git checkout -b mybranch<\/pre>\n<ul>\n<li>Add new line &#8216;Changed from mybranch.&#8217; in the 2nd line of the file &#8216;myfile.txt&#8217;.<\/li>\n<li>Commit the file to &#8216;mybranch&#8217;.<\/li>\n<li>Now, Checkout to &#8216;master&#8217;.<\/li>\n<li>Add new line &#8216;Changed from master&#8217; in the 2nd line of the file &#8216;myfile.txt&#8217;.<\/li>\n<li>Commit the file to &#8216;master&#8217;.<\/li>\n<li>Finally, merge &#8216;mybranch&#8217; to &#8216;master&#8217; using the command below. You will see an error.\n<pre class=\"brush:bash\">git merge mybranch<\/pre>\n<\/li>\n<\/ul>\n<p><figure id=\"attachment_53423\" aria-describedby=\"caption-attachment-53423\" style=\"width: 533px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/12\/conflict-1-watermarked.jpg\"><img decoding=\"async\" class=\"wp-image-53423 size-full\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/12\/conflict-1-watermarked.jpg\" alt=\"\" width=\"533\" height=\"561\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/12\/conflict-1-watermarked.jpg 533w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/12\/conflict-1-watermarked-285x300.jpg 285w\" sizes=\"(max-width: 533px) 100vw, 533px\" \/><\/a><figcaption id=\"caption-attachment-53423\" class=\"wp-caption-text\">Fig. 1: conflict scenario<\/figcaption><\/figure><br \/>\n<figure id=\"attachment_53427\" aria-describedby=\"caption-attachment-53427\" style=\"width: 498px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/12\/conflict-2-watermarked.jpg\"><img decoding=\"async\" class=\"wp-image-53427 size-full\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/12\/conflict-2-watermarked.jpg\" alt=\"\" width=\"498\" height=\"213\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/12\/conflict-2-watermarked.jpg 498w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/12\/conflict-2-watermarked-300x128.jpg 300w\" sizes=\"(max-width: 498px) 100vw, 498px\" \/><\/a><figcaption id=\"caption-attachment-53427\" class=\"wp-caption-text\">Fig. 2: conflict scenario contd.<\/figcaption><\/figure><br \/>\n<figure id=\"attachment_53428\" aria-describedby=\"caption-attachment-53428\" style=\"width: 554px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/12\/conflict-error-watermarked.jpg\"><img decoding=\"async\" class=\"wp-image-53428 size-full\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/12\/conflict-error-watermarked.jpg\" alt=\"\" width=\"554\" height=\"85\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/12\/conflict-error-watermarked.jpg 554w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/12\/conflict-error-watermarked-300x46.jpg 300w\" sizes=\"(max-width: 554px) 100vw, 554px\" \/><\/a><figcaption id=\"caption-attachment-53428\" class=\"wp-caption-text\">Fig. 3: conflict error<\/figcaption><\/figure><div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<h2>4. Mergetool<\/h2>\n<p>Now we have a conflict, because we changed the same line of a file in both branches. As Git cannot resolve this conflict automatically, we have to solve it by ourselves. Here, we will use Git Merge tool&nbsp; to resolve this. Use the command:<\/p>\n<pre class=\"brush:bash\">git mergetool<\/pre>\n<p>Since we have not configured any merge tool yet, git uses the default tool (in this case, it is vimdiff).<\/p>\n<p><figure id=\"attachment_53527\" aria-describedby=\"caption-attachment-53527\" style=\"width: 777px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/12\/mergetool-final-watermarked.jpg\"><img decoding=\"async\" class=\"size-full wp-image-53527\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/12\/mergetool-final-watermarked.jpg\" alt=\"\" width=\"777\" height=\"235\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/12\/mergetool-final-watermarked.jpg 777w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/12\/mergetool-final-watermarked-300x91.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/12\/mergetool-final-watermarked-768x232.jpg 768w\" sizes=\"(max-width: 777px) 100vw, 777px\" \/><\/a><figcaption id=\"caption-attachment-53527\" class=\"wp-caption-text\">Fig. 4: mergetool<\/figcaption><\/figure><\/p>\n<p>It opens up a view with 4 different panes.<\/p>\n<ul>\n<li>The top-left pane displays content of the file from the current branch, which is master in our case. This is called LOCAL.<\/li>\n<li>The top-right pane displays content from the remote branch, from where we are trying to merge, which is &#8216;mybranch&#8217; in our case. This is called REMOTE.<\/li>\n<li>The top-center pane displays content from the common ancestor. This is the version of the file from where both the &#8216;master&#8217; and &#8216;mybranch&#8217; versions started diverging. This is called BASE.<\/li>\n<li>The bottom pane&nbsp;displays content after the merge is performed. This is called MERGED.<\/li>\n<\/ul>\n<p><figure id=\"attachment_53522\" aria-describedby=\"caption-attachment-53522\" style=\"width: 814px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/12\/vimdiff-final-watermarked.jpg\"><img decoding=\"async\" class=\"wp-image-53522 size-full\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/12\/vimdiff-final-watermarked.jpg\" alt=\"\" width=\"814\" height=\"371\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/12\/vimdiff-final-watermarked.jpg 814w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/12\/vimdiff-final-watermarked-300x137.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/12\/vimdiff-final-watermarked-768x350.jpg 768w\" sizes=\"(max-width: 814px) 100vw, 814px\" \/><\/a><figcaption id=\"caption-attachment-53522\" class=\"wp-caption-text\">Fig. 5: vimdiff<\/figcaption><\/figure><\/p>\n<p>As you can see in the MERGED pane (bottom), the content where the conflict is present is wrapped around the lines<\/p>\n<p><code>&lt;&lt;&lt;&lt;&lt;&lt;&lt; HEAD<\/code> and <code>&gt;&gt;&gt;&gt;&gt; mybranch<\/code> separated by <code>=======<\/code><\/p>\n<p>We can manually resolve the merge conflict by editing the content in the bottom pane, and then saving the file using <code>:wqa<\/code> (Write and Quit all files).<\/p>\n<p>Otherwise, if you need only content of the file from one of the branches, and not a mixture of both, you can use the below commands:<br \/>\n<span id=\"section4\"><\/span><br \/>\nTo get LOCAL version to MERGED <code>:diffg LO<\/code><br \/>\nTo get REMOTE version to MERGED <code>:diffg RE<\/code><br \/>\nTo get BASE version to MERGED <code>:diffg BA<\/code><\/p>\n<p>Once the conflict resolution is successful, the merged file will be staged for commit.<br \/>\nFinally, we have to commit the merged file, using<\/p>\n<pre class=\"brush:bash\">git commit -m 'Merged from multiple branches'.<\/pre>\n<p>Compared to merging the files manually, <strong>mergetool<\/strong> offers a better interface where we can view the changes from both the branches, base and merged content all in one place, thereby reducing the chances of human error while merging the file.<\/p>\n<h2>5. Configure a mergetool of your choice<\/h2>\n<p>This section describes how to configure a mergetool of your choice. Though we explain the steps taking KDiff3 as editor, the steps involved are same for any editor you like to use, among the ones supported by Git.[ulp id=&#8217;pzgfvmZhgslwSymm&#8217;]<\/p>\n<h3>5.1 help<\/h3>\n<p>If you like to know which editors are supported by Git, you can use the command:<\/p>\n<pre class=\"brush:bash\">git mergetool --tool-help<\/pre>\n<p><figure id=\"attachment_53398\" aria-describedby=\"caption-attachment-53398\" style=\"width: 806px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/12\/tool-help-watermarked.jpg\"><img decoding=\"async\" class=\"wp-image-53398 size-full\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/12\/tool-help-watermarked.jpg\" alt=\"\" width=\"806\" height=\"464\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/12\/tool-help-watermarked.jpg 806w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/12\/tool-help-watermarked-300x173.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/12\/tool-help-watermarked-768x442.jpg 768w\" sizes=\"(max-width: 806px) 100vw, 806px\" \/><\/a><figcaption id=\"caption-attachment-53398\" class=\"wp-caption-text\">Fig. 6: tool-help<\/figcaption><\/figure><\/p>\n<h3>5.2 setup kdiff3<\/h3>\n<p>Make sure you have KDiff3 installed on your computer and Path variable contains the path to KDiff3 executable, before we proceed further.<\/p>\n<p>To configure kdiff3 as your preferred editor, using one of the below commands:<\/p>\n<pre class=\"brush:bash\">git config merge.tool kdiff3\ngit mergetool --tool=kdiff3\ngit mergetool -t kdiff3\n<\/pre>\n<p>You can set a different path to kdiff3 executable, by using the command:<\/p>\n<pre class=\"brush:bash\">git config mergetool.kdiff3.path \"C:\/Program Files\/KDiff3\/kdiff3.exe\"<\/pre>\n<p>In the above case, you don&#8217;t have to write the executable path in Path variable.<\/p>\n<h3>5.3 prompt<\/h3>\n<p>In case you want to be prompted each time the merge tool editor is invoked, use <code>--prompt<\/code> option as below:<\/p>\n<pre class=\"brush:bash\">git mergetool --tool=kdiff3 --prompt<\/pre>\n<p>Using <code>--no-prompt<\/code> option does not prompt each time the merge tool is invoked, this is the default setting when tool is invoked using &#8211;tool or merge.tool options. You can use the option in one of the two ways below.<\/p>\n<pre class=\"brush:bash\">git mergetool --tool=kdiff3 --no-prompt<\/pre>\n<pre class=\"brush:bash\">git mergetool --tool=kdiff3 -y<\/pre>\n<h3>5.4 trustExitCode<\/h3>\n<p>If your merge tool can indicate that a merge conflict is resolved successfully with its exit code, we can set <code>trustExitCode<\/code> to true, as below:<\/p>\n<pre class=\"brush:bash\">git config mergetool.kdiff3.trustExitCode true<\/pre>\n<p>Otherwise, you will be prompted to indicate whether the merge conflict is resolved or not.<\/p>\n<h3>&nbsp;5.5 keepBackup<\/h3>\n<p>While resolving conflicts, mergetool creates backup files (with extension *.orig). These can be removed safely once the merge session is completed. If you want to automatically remove these files once conflicts are resolved successfully, set the <code>keepBackup<\/code> flag to false as below:<\/p>\n<pre class=\"brush:bash\">git config mergetool.kdiff3.keepBackup false<\/pre>\n<h3>5.6 &#8211;global<\/h3>\n<p>Wherever <code>git config<\/code> is used in the above steps, you can use <code>--global<\/code> if you want to use the same configuration for all the Git projects in your computer. Using <code>--global<\/code> writes the config information into .gitconfig file under &lt;your_user_home&gt; directory or&nbsp; &lt;your_user_home&gt;\/Documents path.<\/p>\n<p>If there is no <code>--global<\/code>, the config information is written into your &lt;your_git_project_folder&gt;\/.git\/config.<\/p>\n<h3>5.7 Using config entries<\/h3>\n<p>An easier way to execute the above steps is by using the config file to make entries as below.<\/p>\n<p>You can either write the below config in&nbsp;&lt;your_user_home&gt;\/.gitconfig or &lt;project_root&gt;\/.git\/config<\/p>\n<pre class=\"brush:bash\">[merge]\n   tool = kdiff3\n[mergetool \"kdiff3\"]\n   path = C:\/Program Files\/KDiff3\/kdiff3.exe\n   trustExitCode = true\n[mergetool]\n   keepBackup = false<\/pre>\n<h2>6. KDiff3 as mergetool<\/h2>\n<p>After we have setup KDiff3 as our mergetool following the above steps, lets see how KDiff3 presents the content for us.<\/p>\n<p>Once are we are in a conflict situation, use the command<\/p>\n<pre class=\"brush:bash\">git mergetool --tool=kdiff3<\/pre>\n<p>in order to launch kdiff3.<\/p>\n<p>The picture below shows 4 different panes. Please note there is a small difference in how the panes are arranged in vimdiff and kdiff3.<\/p>\n<ul>\n<li>Top-right and Bottom panes still display REMOTE &amp; MERGED versions of the file respectively.<\/li>\n<li>Top-left pane displays BASE.<\/li>\n<li>Top-center pane displays LOCAL.<\/li>\n<\/ul>\n<p><figure id=\"attachment_53524\" aria-describedby=\"caption-attachment-53524\" style=\"width: 825px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/12\/kdiff-final-watermarked.jpg\"><img decoding=\"async\" class=\"wp-image-53524 size-full\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/12\/kdiff-final-watermarked.jpg\" alt=\"\" width=\"825\" height=\"463\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/12\/kdiff-final-watermarked.jpg 825w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/12\/kdiff-final-watermarked-300x168.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/12\/kdiff-final-watermarked-768x431.jpg 768w\" sizes=\"(max-width: 825px) 100vw, 825px\" \/><\/a><figcaption id=\"caption-attachment-53524\" class=\"wp-caption-text\">Fig. 7: kdiff<\/figcaption><\/figure><\/p>\n<p>You can now resolve the merge conflict, and save the merged file. Then commit the file, as we did at the end of <a href=\"#section4\">Section 4<\/a> with vimdiff.<\/p>\n<h2>7. Conclusion<\/h2>\n<p>With this, our Git Mergetool example comes to an end. We have now learnt what <code>git mergetool<\/code> is all about, how it can help resolve merge conflicts better, various configuration options of mergetool, and how to configure vimdiff and kdiff3 as your merge tools. We covered most of the areas around <code>git mergetool<\/code> in this example.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Merge Conflicts are undesirable for most of the developers for various reasons. No matter how careful and collaborative developers are, they often end up in merge conflicts. There are multiple ways to resolve merge conflicts, and each developer prefers a different way. Compared to other version control systems like SVN, CVS etc, resolving conflicts with &hellip;<\/p>\n","protected":false},"author":147,"featured_media":27377,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1353],"tags":[1203,1508,1688,1687,1689],"class_list":["post-53344","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-git","tag-git","tag-git-branch","tag-merge-conflict","tag-mergetool","tag-resolve-conflict"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Git Mergetool Example - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"Merge Conflicts are undesirable for most of the developers for various reasons. No matter how careful and collaborative developers are, they often end up\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-mergetool-example\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Git Mergetool Example - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"Merge Conflicts are undesirable for most of the developers for various reasons. No matter how careful and collaborative developers are, they often end up\" \/>\n<meta property=\"og:url\" content=\"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-mergetool-example\/\" \/>\n<meta property=\"og:site_name\" content=\"Examples Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2018-01-03T09:00:42+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-04-23T11:22:30+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/git-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Naveen Prapulla\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Naveen Prapulla\" \/>\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:\/\/examples.javacodegeeks.com\/software-development\/git\/git-mergetool-example\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-mergetool-example\/\"},\"author\":{\"name\":\"Naveen Prapulla\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/200e6dd40369a6c92557dfb07216776b\"},\"headline\":\"Git Mergetool Example\",\"datePublished\":\"2018-01-03T09:00:42+00:00\",\"dateModified\":\"2019-04-23T11:22:30+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-mergetool-example\/\"},\"wordCount\":1349,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-mergetool-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/git-logo.jpg\",\"keywords\":[\"git\",\"git branch\",\"merge conflict\",\"mergetool\",\"resolve conflict\"],\"articleSection\":[\"Git\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-mergetool-example\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-mergetool-example\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-mergetool-example\/\",\"name\":\"Git Mergetool Example - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-mergetool-example\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-mergetool-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/git-logo.jpg\",\"datePublished\":\"2018-01-03T09:00:42+00:00\",\"dateModified\":\"2019-04-23T11:22:30+00:00\",\"description\":\"Merge Conflicts are undesirable for most of the developers for various reasons. No matter how careful and collaborative developers are, they often end up\",\"breadcrumb\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-mergetool-example\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-mergetool-example\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-mergetool-example\/#primaryimage\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/git-logo.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/git-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-mergetool-example\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/examples.javacodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Software Development\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/software-development\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Git\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/software-development\/git\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Git Mergetool Example\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Examples and Code Snippets\",\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/javacodegeeks\",\"https:\/\/x.com\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/200e6dd40369a6c92557dfb07216776b\",\"name\":\"Naveen Prapulla\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/12\/Naveen-Prapulla_avatar_1512986964-96x96.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/12\/Naveen-Prapulla_avatar_1512986964-96x96.jpg\",\"caption\":\"Naveen Prapulla\"},\"description\":\"Naveen Prapulla Saddala has graduated from BITS, Pilani - Goa Campus, India in 2008. He has 9+ years of experience in Software development. So far in his career, he developed products using Java\/J2EE, Spring, Hibernate, JPA, Struts, REST Web services, Groovy, Grails, JQuery, Ajax, ExtJS, Backbone.js. He is well versed with JBOSS, Tomcat and Spring Boot. He also has experience in fixing vulnerabilities in code by using Secure Coding Techniques such as Prevention of Cross-Site Scripting (XSS), Cross-Site Request Forgery, SQL Injection attacks, among others. He is interested in working on projects on Big Data Analytics, Machine Learning, Artificial Intelligence. He is currently working as a Technology Lead in one of the biggest travel domain companies in the world.\",\"url\":\"https:\/\/examples.javacodegeeks.com\/author\/naveen-prapulla\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Git Mergetool Example - Java Code Geeks","description":"Merge Conflicts are undesirable for most of the developers for various reasons. No matter how careful and collaborative developers are, they often end up","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:\/\/examples.javacodegeeks.com\/software-development\/git\/git-mergetool-example\/","og_locale":"en_US","og_type":"article","og_title":"Git Mergetool Example - Java Code Geeks","og_description":"Merge Conflicts are undesirable for most of the developers for various reasons. No matter how careful and collaborative developers are, they often end up","og_url":"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-mergetool-example\/","og_site_name":"Examples Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2018-01-03T09:00:42+00:00","article_modified_time":"2019-04-23T11:22:30+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/git-logo.jpg","type":"image\/jpeg"}],"author":"Naveen Prapulla","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Naveen Prapulla","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-mergetool-example\/#article","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-mergetool-example\/"},"author":{"name":"Naveen Prapulla","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/200e6dd40369a6c92557dfb07216776b"},"headline":"Git Mergetool Example","datePublished":"2018-01-03T09:00:42+00:00","dateModified":"2019-04-23T11:22:30+00:00","mainEntityOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-mergetool-example\/"},"wordCount":1349,"commentCount":1,"publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-mergetool-example\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/git-logo.jpg","keywords":["git","git branch","merge conflict","mergetool","resolve conflict"],"articleSection":["Git"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-mergetool-example\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-mergetool-example\/","url":"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-mergetool-example\/","name":"Git Mergetool Example - Java Code Geeks","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-mergetool-example\/#primaryimage"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-mergetool-example\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/git-logo.jpg","datePublished":"2018-01-03T09:00:42+00:00","dateModified":"2019-04-23T11:22:30+00:00","description":"Merge Conflicts are undesirable for most of the developers for various reasons. No matter how careful and collaborative developers are, they often end up","breadcrumb":{"@id":"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-mergetool-example\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-mergetool-example\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-mergetool-example\/#primaryimage","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/git-logo.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/git-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/examples.javacodegeeks.com\/software-development\/git\/git-mergetool-example\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/examples.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Software Development","item":"https:\/\/examples.javacodegeeks.com\/category\/software-development\/"},{"@type":"ListItem","position":3,"name":"Git","item":"https:\/\/examples.javacodegeeks.com\/category\/software-development\/git\/"},{"@type":"ListItem","position":4,"name":"Git Mergetool Example"}]},{"@type":"WebSite","@id":"https:\/\/examples.javacodegeeks.com\/#website","url":"https:\/\/examples.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Examples and Code Snippets","publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/examples.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/examples.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/200e6dd40369a6c92557dfb07216776b","name":"Naveen Prapulla","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/12\/Naveen-Prapulla_avatar_1512986964-96x96.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/12\/Naveen-Prapulla_avatar_1512986964-96x96.jpg","caption":"Naveen Prapulla"},"description":"Naveen Prapulla Saddala has graduated from BITS, Pilani - Goa Campus, India in 2008. He has 9+ years of experience in Software development. So far in his career, he developed products using Java\/J2EE, Spring, Hibernate, JPA, Struts, REST Web services, Groovy, Grails, JQuery, Ajax, ExtJS, Backbone.js. He is well versed with JBOSS, Tomcat and Spring Boot. He also has experience in fixing vulnerabilities in code by using Secure Coding Techniques such as Prevention of Cross-Site Scripting (XSS), Cross-Site Request Forgery, SQL Injection attacks, among others. He is interested in working on projects on Big Data Analytics, Machine Learning, Artificial Intelligence. He is currently working as a Technology Lead in one of the biggest travel domain companies in the world.","url":"https:\/\/examples.javacodegeeks.com\/author\/naveen-prapulla\/"}]}},"_links":{"self":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/53344","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/users\/147"}],"replies":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=53344"}],"version-history":[{"count":0,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/53344\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media\/27377"}],"wp:attachment":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=53344"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=53344"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=53344"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}