# Java Tutorial: Expressions, Statements, Code blocks, Methods and more

# [Note] DiffMerge Tool

DiffMerge 是一款免費、跨平台的文件比較工具,具備圖形介面方便追蹤檢查文件、文件夾的更動,並且可以進行差異代碼的合併。可以參考 Two Bit Labs | Using DiffMerge as your Git visual merge and diff tool 中的設定將 DiffMerge 與 git 進行集成:

$ git config --global diff.tool diffmerge
$ git config --global difftool.diffmerge.cmd 'diffmerge "$LOCAL" "$REMOTE"'
$ git config --global merge.tool diffmerge
$ git config --global mergetool.diffmerge.cmd 'diffmerge --merge --result="$MERGED" "$LOCAL" "$(if test -f "$BASE"; then echo "$BASE"; else echo "$LOCAL"; fi)" "$REMOTE"'
$ git config --global mergetool.diffmerge.trustExitCode true

設定好之後,便可以使用以下命令來進行文件比對與合併:

# diff the local file.m against the checked-in version
$ git difftool file.m

# diff the local file.m against the version in some-feature-branch
$ git difftool some-feature-branch file.m

# diff the file.m from the Build-54 tag to the Build-55 tag
$ git difftool Build-54..Build-55 file.m

# Resolve merge conflicts, just run git mergetool:
$ git mergetool

# [Note] Overloading

Last Updated: 12/15/2020, 10:27:30 PM