Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Try: <code>git mergetool</code></p> <p>It opens a GUI that steps you through each conflict, and you get to choose how to merge. Sometimes it requires a bit of hand editing afterwards, but usually it's enough by itself. It is much better than doing the whole thing by hand certainly.</p> <p>As per @JoshGlover comment:</p> <p>The command doesn't necessarily open a GUI unless you install one. Running <code>git mergetool</code> for me resulted in <code>vimdiff</code> being used. You can install one of the following tools to use it instead: <code>meld</code>, <code>opendiff</code>, <code>kdiff3</code>, <code>tkdiff</code>, <code>xxdiff</code>, <code>tortoisemerge</code>, <code>gvimdiff</code>, <code>diffuse</code>, <code>ecmerge</code>, <code>p4merge</code>, <code>araxis</code>, <code>vimdiff</code>, <code>emerge</code>.</p> <p>Below is the sample procedure to use <code>vimdiff</code> for resolve merge conflicts. Based on <a href="http://www.rosipov.com/blog/use-vimdiff-as-git-mergetool/#fromHistor" rel="noreferrer">this link</a></p> <p><strong>Step 1</strong>: Run following commands in your terminal</p> <pre><code>git config merge.tool vimdiff git config merge.conflictstyle diff3 git config mergetool.prompt false </code></pre> <p>This will set vimdiff as the default merge tool.</p> <p><strong>Step 2</strong>: Run following command in terminal</p> <pre><code>git mergetool </code></pre> <p><strong>Step 3</strong>: You will see a vimdiff display in following format </p> <pre><code> +----------------------+ | | | | |LOCAL |BASE |REMOTE | | | | | +----------------------+ | MERGED | | | +----------------------+ </code></pre> <p>These 4 views are </p> <blockquote> <p>LOCAL – this is file from the current branch </p> <p>BASE – common ancestor, how file looked before both changes </p> <p>REMOTE – file you are merging into your branch </p> <p>MERGED – merge result, this is what gets saved in the repo</p> </blockquote> <p>You can navigate among these views using <code>ctrl+w</code>. You can directly reach MERGED view using <code>ctrl+w</code> followed by <code>j</code>.</p> <p>More info about vimdiff navigation <a href="https://stackoverflow.com/questions/4556184/vim-move-window-left-right">here</a> and <a href="https://stackoverflow.com/questions/27151456/how-do-i-jump-to-the-next-prev-diff-in-git-difftool">here</a></p> <p><strong>Step 4</strong>. You could edit the MERGED view the following way </p> <p>If you want to get changes from REMOTE</p> <pre><code>:diffg RE </code></pre> <p>If you want to get changes from BASE</p> <pre><code>:diffg BA </code></pre> <p>If you want to get changes from LOCAL</p> <pre><code>:diffg LO </code></pre> <p><strong>Step 5</strong>. Save, Exit, Commit and Clean up</p> <p><code>:wqa</code> save and exit from vi</p> <p><code>git commit -m "message"</code></p> <p><code>git clean</code> Remove extra files (e.g. *.orig) created by diff tool.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload