搞定Git中文乱码、用TortoiseMerge实现DiffMerge(来自csdn论坛)

 

首先说明:这里介绍的方法都是大部分是本人“悟”出来的,所以网上难有流传!
好方法不能自己私藏,否则就白忙乎这几天了,分享给有需要的朋友们。如果有转载,敬请注明来自*CSDN老邓*作品。
呵呵,给自己打广告,实在是无耻之极,权当无聊之时打字之用。
欢迎流传,为最优秀的分布式版本管理系统Git做宣传!!

步骤:
1. 下载:http://loaden.googlecode.com/files/gitconfig.7z
2. 解压到:<MsysGit安装目录>/cmd/,例如:D:\Program Files\Git\cmd
3. 进入Bash,执行gitconfig

搞定什么了?
看看gitconfig的内容先:

#!/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,这篇文章就直接无视吧。             

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值