git一些常用设置

用法:git config [选项]

配置文件位置
    --global              使用全局配置文件
    --system              使用系统级配置文件
    --local               使用版本库级配置文件
    -f, --file <文件>     使用指定的配置文件
    --blob <数据对象ID>   从给定的数据对象读取配置

操作
    --get                 获取值:name [value-regex]
    --get-all             获得所有的值:key [value-regex]
    --get-regexp          根据正则表达式获得值:name-regex [value-regex]
    --get-urlmatch        获得 URL 取值:section[.var] URL
    --replace-all         替换所有匹配的变量:name value [value_regex]
    --add                 添加一个新的变量:name value
    --unset               删除一个变量:name [value-regex]
    --unset-all           删除所有匹配项:name [value-regex]
    --rename-section      重命名小节:old-name new-name
    --remove-section      删除一个小节:name
    -l, --list            列出所有
    -e, --edit            打开一个编辑器
    --get-color <slot>    找到配置的颜色:[默认]
    --get-colorbool <slot>
                          找到颜色设置:[stdout-is-tty]

类型
    --bool                值是 "true" 或 "false"
    --int                 值是十进制数
    --bool-or-int         值是 --bool or --int
    --path                值是一个路径(文件或目录名)

其它
    -z, --null            终止值是NUL字节
    --includes            查询时参照 include 指令递归查找


 

1.查看config

  git config --list

  可以列出所有config配置

 1 user.email=tang_m_cong@163.com
 2 user.name=thomas
 3 core.editor=vim
 4 alias.co=checkout
 5 alias.br=branch
 6 alias.ci=commit
 7 alias.st=status
 8 alias.last=log -1 HEAD
 9 alias.d=difftool
10 color.diff=auto
11 color.status=auto
12 color.branch=auto
13 diff.tool=bc3
14 difftool.bc3.path=/usr/bin/bcompare
15 merge.tool=bc3
16 mergetool.bc3.path=usr/bin/bcompare
17 difftool.prompt=false
18 mergetool.prompt=false
19 core.repositoryformatversion=0
20 core.filemode=true
21 core.bare=false
22 core.logallrefupdates=true
23 remote.origin.url=https://git.oschina.net/thammer/hisimain.git
24 remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
25 branch.master.remote=origin
26 branch.master.merge=refs/heads/master

 

2.常用config:

  git config --global diff.tool bc3

  git config  --global difftool.bc3.path "/usr/bin/bcompare"

  git config --global difftool.prompt false 

  git config --global alias.dt difftool

 

3.杂七杂八

  git log --name-status:查看提交时修改了哪些文件

  • git add -A All
  • git add . stages new and modified, without deleted
  • git add -u without new

后续补充

posted @ 2015-07-29 22:46  thammer  阅读(415)  评论(0编辑  收藏  举报