0%

git-diff技巧

git difftool

git difftool -t meld -y branch1 branch2
git difftool -t meld -y commitId1  commitId2
git difftool -t meld -y HEAD

git config

~/.gitconfig

[diff]
    tool = meld
[difftool]
    prompt = false

[merge]
    tool = jellybc3
[mergetool]
    prompt = false

git支持的比较工具列表:

  • bc3
  • kdiff3
  • kompare
  • tkdiff
  • meld
  • xxdiff
  • emerge
  • vimdiff
  • gvimdiff
  • ecmerge
  • diffuse
  • opendiff
  • p4merge
  • araxis

bc3

[diff]
    tool = bc3
[difftool]
    prompt = false
[merge]
    tool = bc3
[mergetool]
    prompt = false

使用方法

查看diff

git difftool

使用bc解决冲突

git mergetool

Ref

  1. Git diff代码比较的高级技巧
  2. 推荐Git可视化比较工具P4Merge
  3. Git下使用Beyond Compare作为比较和合并工具