Skip to content

Instantly share code, notes, and snippets.

@databill86
Forked from denji/Git_mergetool_tutorial.md
Created September 24, 2019 14:28
Show Gist options
  • Save databill86/6fd2493c994ab3879e01b2b1c40395fb to your computer and use it in GitHub Desktop.
Save databill86/6fd2493c994ab3879e01b2b1c40395fb to your computer and use it in GitHub Desktop.

Revisions

  1. Karen Ng revised this gist Sep 21, 2015. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions Git_mergetool_tutorial.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,6 @@
    # Table Of Content
    Skip to the relevant sections if needed.
    * [2-min tutorial to do it the quick-and-dirty-way](http://www.git-tower.com/learn/git/ebook/command-line/advanced-topics/merge-conflicts)
    * [Concepts for resolving `Git conflicts`](#concepts-for-resolving-git-conflicts)
    * [Setting up different editors / tool for using `git mergetool`](#setting-up-different-editors--tool-for-using-git-mergetool)
    * [Finding out what `mergetool` editors are supported](#finding-out-what-mergetool-editors-are-supported)
  2. Karen Ng revised this gist Sep 21, 2015. No changes.
  3. Karen Ng revised this gist Sep 21, 2015. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions Git_mergetool_tutorial.md
    Original file line number Diff line number Diff line change
    @@ -151,6 +151,7 @@ $ git rebase –continue
    ```
    This command will
    > Forward-port local commits to the updated upstream HEAD.
    according to the documentation, meaning your local commits will be pushed to the `upstream remote branch`
    as a new forward commit that doesn't interfere with previous commits.
    Hooray now you can claim that you can collaborate with others with Git without messing up with your collaborators' commits.
  4. Karen Ng revised this gist Sep 21, 2015. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion Git_mergetool_tutorial.md
    Original file line number Diff line number Diff line change
    @@ -149,7 +149,10 @@ follow all steps in the previous section for using the `mergetool`, then do:
    ```
    $ git rebase –continue
    ```
    This command will `Forward-port local commits to the updated updstream HEAD`.
    This command will
    > Forward-port local commits to the updated upstream HEAD.
    according to the documentation, meaning your local commits will be pushed to the `upstream remote branch`
    as a new forward commit that doesn't interfere with previous commits.
    Hooray now you can claim that you can collaborate with others with Git without messing up with your collaborators' commits.

    [back to top](#table-of-content)
  5. Karen Ng revised this gist Sep 21, 2015. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions Git_mergetool_tutorial.md
    Original file line number Diff line number Diff line change
    @@ -10,8 +10,8 @@ Skip to the relevant sections if needed.
    # Concepts for resolving `Git conflicts`
    For using `mergetool` in `git`, we need to understand the following terminology to understand what is being merged:

    * `LOCAL` - the `HEAD` for the file(s) from the current branch on the machine that you are using.
    * `REMOTE` - the `HEAD` for files(s) from a remote location that you are trying to merge into your `LOCAL` branch.
    * `LOCAL` - the `head` for the file(s) from the current branch on the machine that you are using.
    * `REMOTE` - the `head` for files(s) from a remote location that you are trying to merge into your `LOCAL` branch.
    * `BASE` - the common ancestor(s) of `LOCAL` and `BASE`.
    * `MERGED` - the tag / `HEAD` object after the merge - this is saved as a new commit.

  6. Karen Ng revised this gist Sep 21, 2015. 1 changed file with 6 additions and 3 deletions.
    9 changes: 6 additions & 3 deletions Git_mergetool_tutorial.md
    Original file line number Diff line number Diff line change
    @@ -10,12 +10,14 @@ Skip to the relevant sections if needed.
    # Concepts for resolving `Git conflicts`
    For using `mergetool` in `git`, we need to understand the following terminology to understand what is being merged:

    * `LOCAL` - the file(s) from the current branch on the machine that you are using.
    * `REMOTE` - the files(s) from a remote location that you are trying to merge into your `LOCAL` branch.
    * `LOCAL` - the `HEAD` for the file(s) from the current branch on the machine that you are using.
    * `REMOTE` - the `HEAD` for files(s) from a remote location that you are trying to merge into your `LOCAL` branch.
    * `BASE` - the common ancestor(s) of `LOCAL` and `BASE`.
    * `MERGED` - the tag / `HEAD` object after the merge - this is saved as a new commit.

    Common `mergetool` from editors will display both `LOCAL` and `REMOTE` so you can decide which changes to keep.
    Please read [this tutorial explaining the HEAD objects](http://www.sbf5.com/~cduan/technical/git/git-1.shtml) if you do not know what it is. It will help your understanding of Git tremendously.


    # Setting up different editors / tool for using `git mergetool`
    We have to change the `git config` to set a default mergetool.
    @@ -143,10 +145,11 @@ $ git commit -am 'merged from several branches'
    ## Resolving conflict from a `git pull`

    If you were trying to do a `git pull` when you ran into `merge` conflicts,
    follow all steps in the previous section, then do:
    follow all steps in the previous section for using the `mergetool`, then do:
    ```
    $ git rebase –continue
    ```
    This command will `Forward-port local commits to the updated updstream HEAD`.
    Hooray now you can claim that you can collaborate with others with Git without messing up with your collaborators' commits.

    [back to top](#table-of-content)
  7. Karen Ng revised this gist Sep 21, 2015. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions Git_mergetool_tutorial.md
    Original file line number Diff line number Diff line change
    @@ -159,8 +159,8 @@ Hooray now you can claim that you can collaborate with others with Git without m
    [ref](http://amjith.blogspot.com/2008/08/quick-and-dirty-vimdiff-tutorial.html)

    # Other great references and tutorials
    [git mergetool page on git-scm.com](http://git-scm.com/docs/git-mergetool)
    [tutorial about the concepts of branching and merging from Charles Duan](http://www.sbf5.com/~cduan/technical/git/git-3.shtml)
    [more on vimdiff as a git mergetool](http://vim.wikia.com/wiki/A_better_Vimdiff_Git_mergetool)
    * [Git mergetool documentation on git-scm.com](http://git-scm.com/docs/git-mergetool)
    * [Must-read tutorial: the concepts of branching and merging from Charles Duan](http://www.sbf5.com/~cduan/technical/git/git-3.shtml)
    * [Improving Vimdiff as a Git mergetool](http://vim.wikia.com/wiki/A_better_Vimdiff_Git_mergetool)

    [back to top](#table-of-content)
  8. Karen Ng revised this gist Sep 21, 2015. 1 changed file with 3 additions and 2 deletions.
    5 changes: 3 additions & 2 deletions Git_mergetool_tutorial.md
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,8 @@ Skip to the relevant sections if needed.
    * [Concepts for resolving `Git conflicts`](#concepts-for-resolving-git-conflicts)
    * [Setting up different editors / tool for using `git mergetool`](#setting-up-different-editors--tool-for-using-git-mergetool)
    * [Finding out what `mergetool` editors are supported](#finding-out-what-mergetool-editors-are-supported)
    * [`mergetool` simple code example for `vimdiff`](#mergetool-simple-code-example)
    * [`mergetool` simple code example for `vimdiff`](#mergetool-simple-code-example)
    * [Resolving conflict from a `Git pull`](#resolving-conflict-from-a-git-pull)
    * [Other great references and tutorials](#other-great-references-and-tutorials)

    # Concepts for resolving `Git conflicts`
    @@ -139,7 +140,7 @@ Remember to commit the merge.
    ```
    $ git commit -am 'merged from several branches'
    ```
    ## Resolving conflict for a `git pull`
    ## Resolving conflict from a `git pull`

    If you were trying to do a `git pull` when you ran into `merge` conflicts,
    follow all steps in the previous section, then do:
  9. Karen Ng revised this gist Sep 21, 2015. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion Git_mergetool_tutorial.md
    Original file line number Diff line number Diff line change
    @@ -139,7 +139,10 @@ Remember to commit the merge.
    ```
    $ git commit -am 'merged from several branches'
    ```
    Other tips: if you were trying to do a `git pull` when you ran into `merge` conflicts, issue
    ## Resolving conflict for a `git pull`

    If you were trying to do a `git pull` when you ran into `merge` conflicts,
    follow all steps in the previous section, then do:
    ```
    $ git rebase –continue
    ```
  10. Karen Ng revised this gist Sep 21, 2015. 1 changed file with 7 additions and 0 deletions.
    7 changes: 7 additions & 0 deletions Git_mergetool_tutorial.md
    Original file line number Diff line number Diff line change
    @@ -104,6 +104,13 @@ We can bring up the `mergetool`:
    $ git mergetool
    ```
    Then it will bring up the different versions of the file in different `Vim splits` panels.
    ```
    +--------------------------------+
    | LOCAL | BASE | REMOTE |
    +--------------------------------+
    | MERGED |
    +--------------------------------+
    ```
    The top left split panel is the `LOCAL`, top middle split is `BASE` and top right split is `REMOTE`.
    The bottom split refers to the `MERGED` version.
    You can find this info in the bottom bar of each split (I have put 3 yellow rectangles to highlight that info).
  11. Karen Ng revised this gist Sep 21, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Git_mergetool_tutorial.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    # Table Of Content
    Skip to the relevant sections if needed.
    * [Concepts for resolving `Git conflicts`](#concepts-for-resolving-git-conflicts)wi
    * [Concepts for resolving `Git conflicts`](#concepts-for-resolving-git-conflicts)
    * [Setting up different editors / tool for using `git mergetool`](#setting-up-different-editors--tool-for-using-git-mergetool)
    * [Finding out what `mergetool` editors are supported](#finding-out-what-mergetool-editors-are-supported)
    * [`mergetool` simple code example for `vimdiff`](#mergetool-simple-code-example)
  12. Karen Ng revised this gist Sep 21, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Git_mergetool_tutorial.md
    Original file line number Diff line number Diff line change
    @@ -149,7 +149,7 @@ Hooray now you can claim that you can collaborate with others with Git without m

    # Other great references and tutorials
    [git mergetool page on git-scm.com](http://git-scm.com/docs/git-mergetool)
    [tutorial about the concepts of branching and merging from Charles Duan](http://www.sbf5.com/~cduan/technical/git/git-3.shtml)
    [tutorial about the concepts of branching and merging from Charles Duan](http://www.sbf5.com/~cduan/technical/git/git-3.shtml)
    [more on vimdiff as a git mergetool](http://vim.wikia.com/wiki/A_better_Vimdiff_Git_mergetool)

    [back to top](#table-of-content)
  13. Karen Ng revised this gist Sep 21, 2015. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion Git_mergetool_tutorial.md
    Original file line number Diff line number Diff line change
    @@ -149,6 +149,7 @@ Hooray now you can claim that you can collaborate with others with Git without m

    # Other great references and tutorials
    [git mergetool page on git-scm.com](http://git-scm.com/docs/git-mergetool)
    [ref: tutorial about branching and merging from Charles Duan](http://www.sbf5.com/~cduan/technical/git/git-3.shtml)
    [tutorial about the concepts of branching and merging from Charles Duan](http://www.sbf5.com/~cduan/technical/git/git-3.shtml)
    [more on vimdiff as a git mergetool](http://vim.wikia.com/wiki/A_better_Vimdiff_Git_mergetool)

    [back to top](#table-of-content)
  14. Karen Ng revised this gist Sep 21, 2015. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion Git_mergetool_tutorial.md
    Original file line number Diff line number Diff line change
    @@ -5,7 +5,7 @@ Skip to the relevant sections if needed.
    * [Finding out what `mergetool` editors are supported](#finding-out-what-mergetool-editors-are-supported)
    * [`mergetool` simple code example for `vimdiff`](#mergetool-simple-code-example)
    * [Other great references and tutorials](#other-great-references-and-tutorials)
    ni

    # Concepts for resolving `Git conflicts`
    For using `mergetool` in `git`, we need to understand the following terminology to understand what is being merged:

    @@ -26,6 +26,7 @@ We can also set the editor to display the common ancestor `BASE` while we examin
    ```
    $ git config merge.conflictstyle diff3
    ```

    [back to top](#table-of-content)

    ## Finding out what `mergetool` editors are supported
    @@ -149,4 +150,5 @@ Hooray now you can claim that you can collaborate with others with Git without m
    # Other great references and tutorials
    [git mergetool page on git-scm.com](http://git-scm.com/docs/git-mergetool)
    [ref: tutorial about branching and merging from Charles Duan](http://www.sbf5.com/~cduan/technical/git/git-3.shtml)

    [back to top](#table-of-content)
  15. Karen Ng revised this gist Sep 21, 2015. 1 changed file with 6 additions and 1 deletion.
    7 changes: 6 additions & 1 deletion Git_mergetool_tutorial.md
    Original file line number Diff line number Diff line change
    @@ -26,6 +26,7 @@ We can also set the editor to display the common ancestor `BASE` while we examin
    ```
    $ git config merge.conflictstyle diff3
    ```
    [back to top](#table-of-content)

    ## Finding out what `mergetool` editors are supported
    ```
    @@ -49,6 +50,7 @@ Do not prompt before launching the merge resolution tool
    ```
    $ git config mergetool.prompt false
    ```
    [back to top](#table-of-content)

    # `mergetool` simple code example
    [Ref1 for the example](http://www.rosipov.com/blog/use-vimdiff-as-git-mergetool/)
    @@ -135,6 +137,8 @@ $ git rebase –continue
    ```
    Hooray now you can claim that you can collaborate with others with Git without messing up with your collaborators' commits.

    [back to top](#table-of-content)

    ## Other `vimdiff` keyboard shortcuts
    ```
    ]c - Jump to the next change.
    @@ -144,4 +148,5 @@ Hooray now you can claim that you can collaborate with others with Git without m

    # Other great references and tutorials
    [git mergetool page on git-scm.com](http://git-scm.com/docs/git-mergetool)
    [ref: tutorial about branching and merging from Charles Duan](http://www.sbf5.com/~cduan/technical/git/git-3.shtml)
    [ref: tutorial about branching and merging from Charles Duan](http://www.sbf5.com/~cduan/technical/git/git-3.shtml)
    [back to top](#table-of-content)
  16. Karen Ng revised this gist Sep 21, 2015. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions Git_mergetool_tutorial.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    # Table Of Content
    Skip to the relevant sections if needed.
    * [Concepts for resolving `Git conflicts`](#concepts-for-resolving-git-conflicts)
    * [Concepts for resolving `Git conflicts`](#concepts-for-resolving-git-conflicts)wi
    * [Setting up different editors / tool for using `git mergetool`](#setting-up-different-editors--tool-for-using-git-mergetool)
    * [Finding out what `mergetool` editors are supported](#finding-out-what-mergetool-editors-are-supported)
    * [`mergetool` simple code example for `vimdiff`](#mergetool-simple-code-example)
    @@ -87,7 +87,7 @@ $ vim astrophy_obj.txt
    # type `:%s/$/ galaxy/g` in Vim then press enter and save `:wq`
    $ git commit -am 'added galaxy to each line'
    # merge from the astrophy_objects branch to current branch with is master
    # merge from the astrophy_objects branch to current branch, i.e. master
    $ git merge astrophy_objects
    ```
    Then you will see some error messages:
  17. Karen Ng revised this gist Sep 21, 2015. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions Git_mergetool_tutorial.md
    Original file line number Diff line number Diff line change
    @@ -14,7 +14,7 @@ For using `mergetool` in `git`, we need to understand the following terminology
    * `BASE` - the common ancestor(s) of `LOCAL` and `BASE`.
    * `MERGED` - the tag / `HEAD` object after the merge - this is saved as a new commit.

    Common `mergetool` from editors will display both `LOCAL`, `REMOTE` and `BASE` so you can decide which changes to keep.
    Common `mergetool` from editors will display both `LOCAL` and `REMOTE` so you can decide which changes to keep.

    # Setting up different editors / tool for using `git mergetool`
    We have to change the `git config` to set a default mergetool.
    @@ -101,7 +101,7 @@ We can bring up the `mergetool`:
    $ git mergetool
    ```
    Then it will bring up the different versions of the file in different `Vim splits` panels.
    From top left split is the `LOCAL`, top middle split is `BASE` and top right split is `REMOTE`.
    The top left split panel is the `LOCAL`, top middle split is `BASE` and top right split is `REMOTE`.
    The bottom split refers to the `MERGED` version.
    You can find this info in the bottom bar of each split (I have put 3 yellow rectangles to highlight that info).

  18. Karen Ng revised this gist Sep 21, 2015. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions Git_mergetool_tutorial.md
    Original file line number Diff line number Diff line change
    @@ -5,7 +5,7 @@ Skip to the relevant sections if needed.
    * [Finding out what `mergetool` editors are supported](#finding-out-what-mergetool-editors-are-supported)
    * [`mergetool` simple code example for `vimdiff`](#mergetool-simple-code-example)
    * [Other great references and tutorials](#other-great-references-and-tutorials)

    ni
    # Concepts for resolving `Git conflicts`
    For using `mergetool` in `git`, we need to understand the following terminology to understand what is being merged:

    @@ -109,7 +109,7 @@ As you can see form the below image, my `Vim` has highlighted the differences in
    ![Vim mergetool image](https://app.box.com/representation/file_version_37661948594/image_2048/1.png?shared_name=ws92iu1ftjib8pcmq0b8hly0hwwnb1jh)

    Now if your terminal has any GUI capability and you have compiled `Vim` correctly with GUI support, you can use your mouse to click on the bottom split to edit it.
    Or you are a `Vim` ninja, you can use the keyboard shortcut to move to different splits.
    Or if you are a `Vim` ninja, you can use the keyboard shortcut to move to different splits.
    ```
    Ctrl w + h # move to the split on the left
    Ctrl w + j # move to the split below
  19. Karen Ng revised this gist Sep 21, 2015. 1 changed file with 8 additions and 1 deletion.
    9 changes: 8 additions & 1 deletion Git_mergetool_tutorial.md
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,7 @@ Skip to the relevant sections if needed.
    * [Concepts for resolving `Git conflicts`](#concepts-for-resolving-git-conflicts)
    * [Setting up different editors / tool for using `git mergetool`](#setting-up-different-editors--tool-for-using-git-mergetool)
    * [Finding out what `mergetool` editors are supported](#finding-out-what-mergetool-editors-are-supported)
    * [`mergetool` simple code example](#mergetool-simple-code-example)
    * [`mergetool` simple code example for `vimdiff`](#mergetool-simple-code-example)
    * [Other great references and tutorials](#other-great-references-and-tutorials)

    # Concepts for resolving `Git conflicts`
    @@ -135,6 +135,13 @@ $ git rebase –continue
    ```
    Hooray now you can claim that you can collaborate with others with Git without messing up with your collaborators' commits.

    ## Other `vimdiff` keyboard shortcuts
    ```
    ]c - Jump to the next change.
    [c - Jump to the previous change.
    ```
    [ref](http://amjith.blogspot.com/2008/08/quick-and-dirty-vimdiff-tutorial.html)

    # Other great references and tutorials
    [git mergetool page on git-scm.com](http://git-scm.com/docs/git-mergetool)
    [ref: tutorial about branching and merging from Charles Duan](http://www.sbf5.com/~cduan/technical/git/git-3.shtml)
  20. Karen Ng revised this gist Sep 21, 2015. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions Git_mergetool_tutorial.md
    Original file line number Diff line number Diff line change
    @@ -133,6 +133,7 @@ Other tips: if you were trying to do a `git pull` when you ran into `merge` conf
    ```
    $ git rebase –continue
    ```
    Hooray now you can claim that you can collaborate with others with Git without messing up with your collaborators' commits.

    # Other great references and tutorials
    [git mergetool page on git-scm.com](http://git-scm.com/docs/git-mergetool)
  21. Karen Ng revised this gist Sep 21, 2015. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion Git_mergetool_tutorial.md
    Original file line number Diff line number Diff line change
    @@ -51,7 +51,8 @@ $ git config mergetool.prompt false
    ```

    # `mergetool` simple code example
    [Ref for the example](http://www.rosipov.com/blog/use-vimdiff-as-git-mergetool/)
    [Ref1 for the example](http://www.rosipov.com/blog/use-vimdiff-as-git-mergetool/)
    [Ref2](http://flaviusim.com/blog/how-to-do-a-git-merge-with-vim/)

    ## creating the git repo
    ```Bash
  22. Karen Ng revised this gist Sep 21, 2015. 1 changed file with 18 additions and 1 deletion.
    19 changes: 18 additions & 1 deletion Git_mergetool_tutorial.md
    Original file line number Diff line number Diff line change
    @@ -102,7 +102,7 @@ $ git mergetool
    Then it will bring up the different versions of the file in different `Vim splits` panels.
    From top left split is the `LOCAL`, top middle split is `BASE` and top right split is `REMOTE`.
    The bottom split refers to the `MERGED` version.
    You can find this info in the bottom bar of each split (I have put 3 red rectangles to highlight that info).
    You can find this info in the bottom bar of each split (I have put 3 yellow rectangles to highlight that info).

    As you can see form the below image, my `Vim` has highlighted the differences in red for me.
    ![Vim mergetool image](https://app.box.com/representation/file_version_37661948594/image_2048/1.png?shared_name=ws92iu1ftjib8pcmq0b8hly0hwwnb1jh)
    @@ -115,6 +115,23 @@ Ctrl w + j # move to the split below
    Ctrl w + k # move to the split on top
    Ctrl w + l # move to the split on the right
    ```
    You can either incorporate the changes by manually editing the `MERGED` split,
    or use `Vim` shortcuts pull from one of the `LOCAL`, `BASE` ad `REMOTE` versions.

    ```
    :diffg RE # get from REMOTE
    :diffg BA # get from BASE
    :diffg LO # get from LOCAL
    ```
    save the changes then quit with `:wqa` to close all the splits.
    Remember to commit the merge.
    ```
    $ git commit -am 'merged from several branches'
    ```
    Other tips: if you were trying to do a `git pull` when you ran into `merge` conflicts, issue
    ```
    $ git rebase –continue
    ```

    # Other great references and tutorials
    [git mergetool page on git-scm.com](http://git-scm.com/docs/git-mergetool)
  23. Karen Ng revised this gist Sep 21, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Git_mergetool_tutorial.md
    Original file line number Diff line number Diff line change
    @@ -105,7 +105,7 @@ The bottom split refers to the `MERGED` version.
    You can find this info in the bottom bar of each split (I have put 3 red rectangles to highlight that info).

    As you can see form the below image, my `Vim` has highlighted the differences in red for me.
    ![Vim mergetool image](https://app.box.com/representation/file_version_37661948594/image_2048/1.png)
    ![Vim mergetool image](https://app.box.com/representation/file_version_37661948594/image_2048/1.png?shared_name=ws92iu1ftjib8pcmq0b8hly0hwwnb1jh)

    Now if your terminal has any GUI capability and you have compiled `Vim` correctly with GUI support, you can use your mouse to click on the bottom split to edit it.
    Or you are a `Vim` ninja, you can use the keyboard shortcut to move to different splits.
  24. Karen Ng revised this gist Sep 21, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Git_mergetool_tutorial.md
    Original file line number Diff line number Diff line change
    @@ -105,7 +105,7 @@ The bottom split refers to the `MERGED` version.
    You can find this info in the bottom bar of each split (I have put 3 red rectangles to highlight that info).

    As you can see form the below image, my `Vim` has highlighted the differences in red for me.
    ![Vim mergetool image](https://app.box.com/representation/file_version_37661380506/image_2048/1.png?shared_name=ws92iu1ftjib8pcmq0b8hly0hwwnb1jh)
    ![Vim mergetool image](https://app.box.com/representation/file_version_37661948594/image_2048/1.png)

    Now if your terminal has any GUI capability and you have compiled `Vim` correctly with GUI support, you can use your mouse to click on the bottom split to edit it.
    Or you are a `Vim` ninja, you can use the keyboard shortcut to move to different splits.
  25. Karen Ng revised this gist Sep 21, 2015. 1 changed file with 15 additions and 1 deletion.
    16 changes: 15 additions & 1 deletion Git_mergetool_tutorial.md
    Original file line number Diff line number Diff line change
    @@ -99,8 +99,22 @@ We can bring up the `mergetool`:
    ```
    $ git mergetool
    ```
    ![Vim mergetool image](https://app.box.com/representation/file_version_37661092722/image_2048/1.png?shared_name=ws92iu1ftjib8pcmq0b8hly0hwwnb1jh)
    Then it will bring up the different versions of the file in different `Vim splits` panels.
    From top left split is the `LOCAL`, top middle split is `BASE` and top right split is `REMOTE`.
    The bottom split refers to the `MERGED` version.
    You can find this info in the bottom bar of each split (I have put 3 red rectangles to highlight that info).

    As you can see form the below image, my `Vim` has highlighted the differences in red for me.
    ![Vim mergetool image](https://app.box.com/representation/file_version_37661380506/image_2048/1.png?shared_name=ws92iu1ftjib8pcmq0b8hly0hwwnb1jh)

    Now if your terminal has any GUI capability and you have compiled `Vim` correctly with GUI support, you can use your mouse to click on the bottom split to edit it.
    Or you are a `Vim` ninja, you can use the keyboard shortcut to move to different splits.
    ```
    Ctrl w + h # move to the split on the left
    Ctrl w + j # move to the split below
    Ctrl w + k # move to the split on top
    Ctrl w + l # move to the split on the right
    ```

    # Other great references and tutorials
    [git mergetool page on git-scm.com](http://git-scm.com/docs/git-mergetool)
  26. Karen Ng revised this gist Sep 21, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Git_mergetool_tutorial.md
    Original file line number Diff line number Diff line change
    @@ -99,7 +99,7 @@ We can bring up the `mergetool`:
    ```
    $ git mergetool
    ```
    ![Vim mergetool image](https://app.box.com/representation/file_version_37661092722/image_2048/1.png)
    ![Vim mergetool image](https://app.box.com/representation/file_version_37661092722/image_2048/1.png?shared_name=ws92iu1ftjib8pcmq0b8hly0hwwnb1jh)


    # Other great references and tutorials
  27. Karen Ng revised this gist Sep 21, 2015. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions Git_mergetool_tutorial.md
    Original file line number Diff line number Diff line change
    @@ -99,6 +99,7 @@ We can bring up the `mergetool`:
    ```
    $ git mergetool
    ```
    ![Vim mergetool image](https://app.box.com/representation/file_version_37661092722/image_2048/1.png)


    # Other great references and tutorials
  28. Karen Ng revised this gist Sep 21, 2015. 1 changed file with 12 additions and 1 deletion.
    13 changes: 12 additions & 1 deletion Git_mergetool_tutorial.md
    Original file line number Diff line number Diff line change
    @@ -83,12 +83,23 @@ $ git commit -am 'changed bar to barred'
    $ git checkout master # change back to master branch
    $ vim astrophy_obj.txt
    # add the word `galaxy` to the end of each line using Vim REGEX
    # type `:%s/$/ galaxy/g` then press enter and save `:wq`
    # type `:%s/$/ galaxy/g` in Vim then press enter and save `:wq`
    $ git commit -am 'added galaxy to each line'
    # merge from the astrophy_objects branch to current branch with is master
    $ git merge astrophy_objects
    ```
    Then you will see some error messages:
    ```
    Auto-merging astrophy_obj.txt
    CONFLICT (content): Merge conflict in astrophy_obj.txt
    Automatic merge failed; fix conflicts and then commit the result.
    ```
    We can bring up the `mergetool`:
    ```
    $ git mergetool
    ```


    # Other great references and tutorials
    [git mergetool page on git-scm.com](http://git-scm.com/docs/git-mergetool)
  29. Karen Ng revised this gist Sep 21, 2015. 1 changed file with 38 additions and 1 deletion.
    39 changes: 38 additions & 1 deletion Git_mergetool_tutorial.md
    Original file line number Diff line number Diff line change
    @@ -51,7 +51,44 @@ $ git config mergetool.prompt false
    ```

    # `mergetool` simple code example
    [ref](http://www.rosipov.com/blog/use-vimdiff-as-git-mergetool/)
    [Ref for the example](http://www.rosipov.com/blog/use-vimdiff-as-git-mergetool/)

    ## creating the git repo
    ```Bash
    $ mkdir galaxyZoo
    $ cd galaxyZoo
    $ git init
    $ vim astrophy_obj.txt
    ```
    Add some galaxy types into `astrophy_obj.txt` then save the file.
    ```
    # content of astrophy_obj.txt
    spiral
    ellipitcal
    bar
    irregular
    ```
    save then commit the file.

    ```
    $ git add astrophy_obj.txt
    $ git commit -m 'Initial commit'
    $ git branch astrophy_objects # create a new branch
    $ git checkout astrophy_objects # change to new branch
    $ vim astrophy_obj.txt # make changes to file
    ```
    Change `bar` to `barred` in the file.
    ```
    $ git commit -am 'changed bar to barred'
    $ git checkout master # change back to master branch
    $ vim astrophy_obj.txt
    # add the word `galaxy` to the end of each line using Vim REGEX
    # type `:%s/$/ galaxy/g` then press enter and save `:wq`
    $ git commit -am 'added galaxy to each line'
    # merge from the astrophy_objects branch to current branch with is master
    $ git merge astrophy_objects
    ```

    # Other great references and tutorials
    [git mergetool page on git-scm.com](http://git-scm.com/docs/git-mergetool)
  30. Karen Ng revised this gist Sep 21, 2015. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions Git_mergetool_tutorial.md
    Original file line number Diff line number Diff line change
    @@ -37,10 +37,10 @@ And we list a few of them:
    * `Vim` based diff tool: [`vimdiff`](http://www.rosipov.com/blog/use-vimdiff-as-git-mergetool/)

    ### GUI `mergetool` editors
    * `gvimdiff` - almost identical to `vimdiff` but refers to the Linux GUI for `Vim`, please refer to `vimdiff`
    * `kdiff3`
    * `meld`
    * `tortoisemerge`
    * `gvimdiff` - almost identical to `vimdiff` but uses the Linux GUI for `Vim`, please refer to `vimdiff` if you still use the keyboard commands for `GVim`.
    * [`kdiff3`](http://kdiff3.sourceforge.net/)
    * [`meld`](http://blog.deadlypenguin.com/blog/2011/05/03/using-meld-with-git-diff/)
    * [`tortoisemerge`](http://tortoisesvn.net/docs/nightly/TortoiseMerge_en/tmerge-dug.html)

    Or consult the community of your favorite editor to see how to do the equivalent operations for your editor.