美文网首页
git 常用命令2018-09-15

git 常用命令2018-09-15

作者: 尖头核桃 | 来源:发表于2018-09-15 21:51 被阅读0次

    git config

    生效顺序:3 -> 2 -> 1

    1. 对系统上所有用户及他们所拥有的仓库都生效 -> /etc/gitconfig
    git config --system xxx
    

    Git 会读写这个文件。

    1. 每个用户的~/.gitconfig文件
    git config --global xxx
    
    1. 各个库中 Git 目录下的配置文件(.git/config)
    git config xxx
    

    设置git分支的跟踪关系

    1、新建一个分支时设置跟踪关系

    git  checkout -b new_branch_name  [--track] origin/remote_branch_name
    

    --track选项可以省略

    2、设置已有分支和远端分支的跟踪关系

    git  branch -u  origin/remote_branch_name  local_branch_name
    

    注意:-u选项是--set-upstream-to的简写,因此上面这条命令可以写作

    git  branch --set-upstream-to=origin/remote_branch_name  local_branch_name
    

    local_branch_name可以省略,默认值为当前分支

    多个git ssh key 问题

    https://www.jianshu.com/p/f7f4142a1556

    参考文章

    https://sandwind.gitbooks.io/git-pro-cn/content/git-base/get.html
    本地git config配置和git基本操作

    相关文章

      网友评论

          本文标题:git 常用命令2018-09-15

          本文链接:https://www.haomeiwen.com/subject/rcgtnftx.html