• Development

    Using Vimdiff with Git

    ​UPDATED: Check out “git difftool” which makes this process much cleaner (than the commands I previously had listed here). Basically, you can tell git what to use as a diff tool and it’ll let you do things like:

    Here is how I tell git to use vimdiff (these settings go in ~/.gitconfig):

    Here are some helpful commands that will get you started with vimdiff.

    • ctrl+w ctrl+w – switch windows
    • do – diff obtain (grab from the other side)
    • dp – diff put (move to the other side)
    • [c – previous difference
    • ]c – next difference
    • :diffupdate – (updates the diff)
    • :syntax off – syntax off
    • zo – open folded text
    • zc – close folded text

    Lastly, I suggest using the peaksea colorscheme when using vimdiff. It makes it much easier to see the changes and work with them.

    vimdiff
    The peaksea colorscheme with vimdiff