〜/ .gitconfig中的Mac特定优化

Ben*_*ine 13 git macos configuration dvcs

我在Linux上阅读了关于"〜/ .gitconfig"内容的讨论:https://stackoverflow.com/questions/267761/what-does-your-gitconfig-contain

我知道一些Mac特定的优化,例如使用"mate"作为默认编辑器:

[core]
    editor = mate -w
Run Code Online (Sandbox Code Playgroud)

或使用opendiff作为差异编辑器:

[diff]
    external = opendiff
Run Code Online (Sandbox Code Playgroud)

您是否知道我可以在"〜/ .gitconfig"文件中安装/配置的其他Mac特定优化(和/或工具)以获得非常用户友好的git?

Ron*_*iew 23

我使用opendiff和textmate作为git的外部工具.您可以通过在bash中运行以下命令来配置它们:

#TextMate as the default editor
git config --global core.editor "mate -w"

#Opendiff (FileMerge) to resolve merge conflicts:
git config --global merge.tool opendiff

#Opendiff (FileMerge) as diff tool
git config --global diff.tool opendiff
Run Code Online (Sandbox Code Playgroud)

或者,您可以通过添加以下内容来配置gitconfig文件:

[diff]
    tool = opendiff

[merge]
    tool = opendiff

[core]
    editor = mate -w
Run Code Online (Sandbox Code Playgroud)

difftool和mergetool仅在1.6.3版之后可用


Jee*_*eet 2

我更喜欢将默认diff命令保留在内部,以便在终端上进行快速总结,并使用命令访问更高级的 diff 程序(我使用 MacVim)difftool我在这里描述了设置过程。Mac 特定的部分位于我的包装脚本中,如果可用,我会临时启动 MacVim,然后默认使用常规 Vim。当然,如果您愿意的话,您可以适应使用 TextMate。