Skip to content

Instantly share code, notes, and snippets.

@hkuno9000
Last active September 30, 2020 07:13
Show Gist options
  • Save hkuno9000/633ef03079778a3f47dd to your computer and use it in GitHub Desktop.
Save hkuno9000/633ef03079778a3f47dd to your computer and use it in GitHub Desktop.
my git alias and difftool/mergetool for WinMerge
# git config --global -e
[core]
autocrlf = true
excludesfile = C:/Users/hkuno/Documents/gitignore_global.txt
quotepath = false
## http://orangeclover.hatenablog.com/entry/20121004/1349353957
## editor = 'C:/Program Files (x86)/Hidemaru/Hidemaru.exe' //fu8
## editor = 'C:/Program Files (x86)/sakura/sakura.exe' -code=4
## editor = 'C:/Program Files (x86)/EmEditor/EmEditor.exe' //cp 65001
## editor = 'C:/Program Files (x86)/TeraPad/TeraPad.exe' //cu8
editor = '/usr/bin/vim' -c 'set fenc=utf-8'
[alias]
utf8 = !LANG=ja_JP.UTF-8 LESSCHARSET=utf-8 git
sjis = !LANG=ja_JP.SJIS LESSCHARSET=dos git
st = status
co = checkout
ci = commit
br = branch
bl = branch -av
tl = tag -l -n
diffc = diff --cached
difftoolc = difftool --cached
diffs = diff --stat
confg = config --global
logff = log --format=fuller
[merge]
tool = mydiff
[mergetool "mydiff"]
path = C:/Program Files/WinMerge/WinMergeU.exe
cmd = 'C:/Program Files/WinMerge/WinMergeU.exe' -u -fm -wl -wr \"$REMOTE\" \"$MERGED\" \"$LOCAL\"
## cmd = 'C:/Program Files/WinMerge/WinMergeU.exe' -u -fm -wl -wr \"$REMOTE\" \"$BASE\" \"$LOCAL\" -am -o \"$MERGED\"
## -e: close by ESC key
## -u: prevent to append MRU
## -r: recursive search in sub directry
## -wl: readonly left window
## -wr: readonly right window
## -fm: forcus middle window
## -am: auto merge on middle window
## -o FILE: outputpath for merged
## $LOCAL contents of the file on the current branch
## $REMOTE contents of the file to be merged
## $MERGED file to which the merge tool should write the result of the merge resolution
## $BASE common base for the merge, if available
[diff]
tool = mydiff
guitool = mydiff
[difftool "mydiff"]
path = C:/Program Files/WinMerge/WinMergeU.exe
cmd = 'C:/Program Files/WinMerge/WinMergeU.exe' -e -u -r \"$LOCAL\" \"$REMOTE\"
## -e: close by ESC key
## -u: prevent to append MRU
## -r: recursive search in sub directry
## $LOCAL diff pre-image
## $REMOTE diff post-image
## $MERGED the name of the file which is being compared
## $BASE same value as $MERGED.
[diff "xdoc2txt"]
textconv = xdoc2txt.exe -8
## -s : convert to ShiftJIS(default)
## -e : convert to EUC
## -j : convert to JIS
## -u : convert to UTF16(LE)
## -8 : convert to UTF8
## -f : output to file
[credential]
helper = wincred
@hkuno9000
Copy link
Author

GUIツールの起動方法.

# GUI commiter
git gui
# GUI log viewer
gitk
# Winmerge diff
git difftool -d HEAD~1

@hkuno9000
Copy link
Author

windows上にて、push時のログインを省く

git config --global credential.helper wincred

@hkuno9000
Copy link
Author

標準的な diff ツールはすでに git gui に設定が組み込まれている. その一覧は下記で確認できる.

git difftool --tool-help

一覧されたツール名は --tool= で指定して使える.

git difftool --tool=vimdiff HEAD~1

インストールされていても PATH に載っていないツールは not available と一覧表示されるので、パスを設定する

git config --global difftool.kdiff3.path "C:\Program Files\Kdiff3\kdiff3.exe"
git config --global mergetool.kdiff3.path "C:\Program Files\Kdiff3\kdiff3.exe"

それが気に入れば標準ツールに指定する.

git config --global diff.tool kdiff3
git config --global merge.tool kdiff3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment