• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
yuzaipiaofei
博客园    首页    新随笔    联系   管理    订阅  订阅

設定 Git 環境

設定 Git 環境

參考來源:http://progit.org/book/
在這台機器上的預設 git 設定

其實就是設定 ~/.gitconfig 的內容,除了直接編輯外,也可以用指令來設定,例如:

git config --global user.name "yuan wei"
git config --global user.email yuanwei@XXXX.gmail
git config --global core.editor vim
git config --global merge.tool vimdiff

設定完後,執行 git config –list 應該可以看到如下的內容:

user.name=yuanwei 
user.email=yuanwei@XXXX.gmail 
core.editor=vim
merge.tool=vimdiff

事實上,在 ~/.gitconfig 會長這樣:

[user]
        name = Daniel Lin
        email = ooo@ooo.ooo.ooo
[core]
        editor = vim
[merge]
        tool = vimdiff

參考別人的設定

這些是別人的 .gitconfig:

[user]
    name = Daniel Lin
    email = ooo@ooo.ooo.ooo

[core]
    editor = vim

[merge]
    tool = vimdiff

[color]
    diff = auto
    status = auto
    branch = auto
    interactive = auto
    ui = true
    pager = true

[color "branch"]
    current = yellow reverse
    local = yellow
    remote = green

[color "diff"]
    meta = yellow bold
    frag = magenta bold
    old = red bold
    new = green bold

[color "status"]
    added = yellow
    changed = green
    untracked = cyan

[core]
    pager = less -FRSX
    whitespace=fix,-indent-with-non-tab,trailing-space,cr-at-eol

[alias]
    st = status
    ci = commit
    di = diff
    co = checkout
    w = whatchanged
    lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative

[diff]
    renamelimit = 0
posted @ 2012-05-16 14:42  yuzaipiaofei  阅读(148)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3