Search code examples
gitmatlabgit-diffvimdiff

git diff with matlab package directory


I'm having issue running git dff with +Dir01/file.m.

I think the problem is with the + in the directory name. How can I get git diff to work with this?

Thank you in advance.


Solution

  • Vim does not like opening files that have a leading + character. You can try prefacing your path with ./.

    git diff ./+Dir01/file.m
    

    Another way that you can open these types of files with vim is to use -- to indicate that no options should be passed, and then vim won't treat the + as a command.

    vim -- +Dir01/file.m
    

    Knowing this, you could use the -x argument for git difftool.

    git difftool -x "vimdiff --"
    

    You could update your .git/config with the following:

    git config --global difftool.vimdiff.cmd "vimdiff -- \"\$LOCAL\" \"\$REMOTE\""