代码之家  ›  专栏  ›  技术社区  ›  Benoit Courtine

~/.gitconfig中的Mac特定优化[已关闭]

  •  13
  • Benoit Courtine  · 技术社区  · 16 年前

    https://stackoverflow.com/questions/267761/what-does-your-gitconfig-contain

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

    [core]
        editor = mate -w
    

    或者使用opendiff作为diff编辑器:

    [diff]
        external = opendiff
    

    你知道我可以在“~/.gitconfig”文件中安装/配置其他特定于Mac的优化(和/或工具)以获得非常用户友好的git吗?

    3 回复  |  直到 9 年前
        1
  •  2
  •   bunnyhero    12 年前

    我宁愿保留默认值 diff 命令internal,用于在终端进行快速摘要,并使用 difftool 命令。我描述了安装程序 here . Mac特定的部分在包装器脚本中,如果Mac Vim可用,我会在其中临时启动它,然后默认为常规Vim。当然,如果你喜欢的话,你可以使用TextMate。

        2
  •  23
  •   Ronnie Liew    16 年前

    我使用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
    

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

    [diff]
        tool = opendiff
    
    [merge]
        tool = opendiff
    
    [core]
        editor = mate -w
    

    difftool和mergetool仅在版本1.6.3之后可用

        3
  •  4
  •   geewiz    16 年前

    由于git对提交消息重用相同的临时文件,我建议使用

    [core]
        editor = mate -wl1
    

    因此,TextMate每次都将光标放在第一行,而不是记住上次的光标位置。

    如果创建以下shell脚本。。。

    #!/bin/sh
    #
    # ~/bin/git-opendiff.sh
    #
    /usr/bin/opendiff "$2" "$5" -merge "$1"
    

    $ git config --global diff.external ~/bin/git-opendiff.sh
    

    …您可以使用opendiff进行差异和合并。