$HOME/.profilegit confi_git使用tortoisesvn">
赞
踩
git的设置,.gitconfig文件内容如下:
# 全局提交用户名与邮箱
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后,一个命令即可完成配置。
我的git配置:
[user]
email = xxx
name = zazuone
[merge]
tool = tortoise
[mergetool]
keepBackup = false
prompt = false
[diff]
tool = tortoise
external = git-diff-wrapper.sh
[difftool]
prompt = false
TortoiseGitIDiff = .cmd
tortoise = .cmd
[gui]
encoding = utf-8
[i18n]
commitencoding = utf-8
logoutputencoding = gbk
[difftool "tortoise"]
cmd = TortoiseMerge -base:'$LOCAL' -theirs:'$REMOTE'
[mergetool "tortoise"]
cmd = TortoiseMerge -base:'$BASE' -theirs:'$REMOTE' -mine:'$LOCAL' -merged:'$MERGED'
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。