原帖地址: http://topic.csdn.net/u/20110113/19/b0d5d506-4307-428b-a61d-7974aa66a2da.html 首先要说明的是:这里介绍的方法都是大部分是本人“悟”出来的,所以网上难有流传! 好方法不能自己私藏,否则就白忙乎这几天了,分享给有需要的朋友们。如果有转载,敬请注明来自*CSDN老邓*作品。 呵呵,给自己打广告,实在是无耻之极,权当无聊之时打字之用。 欢迎流传,为最优秀的分布式版本管理系统Git做宣传!! 步骤: 1. 下载:http://loaden.googlecode.com/files/gitconfig.7z 2. 解压到:/cmd/,例如:D:\Program Files\Git\cmd 3. 进入Bash,执行gitconfig 搞定什么了? 看看gitconfig的内容先: Perl code #!/bin/sh # 全局提交用户名与邮箱 git config --global user.name "Yuchen Deng" git config --global user.email 邮箱名@gmail.com # 中文编码支持 echo "export LESSCHARSET=utf-8" > $HOME/.profile git config --global gui.encoding utf-8 git config --global i18n.commitencoding utf-8 git config --global i18n.logoutputencoding gbk # 全局编辑器,提交时将COMMIT_EDITMSG编码转换成UTF-8可避免乱码 git config --global core.editor notepad2 # 差异工具配置 git config --global diff.external git-diff-wrapper.sh git config --global diff.tool tortoise git config --global difftool.tortoise.cmd 'TortoiseMerge -base:"$LOCAL" -theirs:"$REMOTE"' git config --global difftool.prompt false # 合并工具配置 git config --global merge.tool tortoise git config --global mergetool.tortoise.cmd 'TortoiseMerge -base:"$BASE" -theirs:"$REMOTE" -mine:"$LOCAL" -merged:"$MERGED"' git config --global mergetool.prompt false # 别名设置 git config --global alias.dt difftool git config --global alias.mt mergetool # 取消 $ git gui 的中文界面,改用英文界面更易懂 if [ -f "/share/git-gui/lib/msgs/zh_cn.msg" ]; then rm /share/git-gui/lib/msgs/zh_cn.msg fi 这个脚本解决了: 1. 中文乱码 2. 图形化Diff/Merge 3. 还原英文界面,更好懂 其中最有价值的,就是Git的Diff/Merge外部工具TortoiseMerge配置。 安装MsysGit后,一个命令即可完成配置。 适用于MsysGit安装版与绿色版。 网上关于为Git配置TortoiseMerge来进行diff和merge的介绍几乎没有(反正我没有搜索到),但我认为TortoiseMerge是最好用的,单文件(一个可执行程序,绿色版,下载地址:http://sourceforge.net/projects/tortoisesvn/files/Tools/1.6.7/TortoiseDiff-1.6.7.zip/download),实在是绝配! 为什么不使用TortoiseGit?他们不是集成了TortoiseMerge吗? 理由:TortoiseGit只有Windows才有,我更喜欢git gui,结合gitk,跨平台实在相同的操作方式,更爽! 如果您离不开TortoiseGit,这篇文章就直接无视吧。