Why doesn't `git diff` invoke external diff tool?

前端 未结 3 1891
执笔经年
执笔经年 2021-02-02 08:22

In my repository, if I type

$ git diff some-file

or

$ git difftool some-file

I get the in-terminal diff displ

3条回答
  •  闹比i
    闹比i (楼主)
    2021-02-02 08:50

    I usually just want to check whether the changes I'm about to check in are correct. So I followed the procedure suggested here (similar to the one noted by VonC). However, running git difftool still didn't open meld. I then created an alias:

    alias git-diff='git difftool $(git rev-parse HEAD)'
    

    Save this in your .bashrc or .zshrc or the corresponding config for your shell. This essentially compares the state of the branch with the previous commit on the branch.

    Do a git-diff to see changes on a file per file basis or git-diff --dir to see all changes in a directory view.

提交回复
热议问题