【问题标题】:How do I add a branch master to git config. I need a command line solution如何将分支 master 添加到 git config。我需要一个命令行解决方案
【发布时间】:2012-09-19 10:00:40
【问题描述】:

我想将这些行添加到 git config。我需要一个命令行解决方案。

[branch "master"]
   remote = origin
   merge = refs/heads/master

【问题讨论】:

    标签: macos git terminal


    【解决方案1】:

    git config branch.master.remote origin 设置值remote。

    git config branch.master.merge refs/heads/master 设置值merge。

    git config branch.master.remote 读取值。

    git config 可用于编辑任何值。规则很简单。我举例说明。 git config a.b.c.d.e.f 42 生成如下配置部分:

    [a "b.c.d.e"]
        f = 42
    

    【讨论】:

      【解决方案2】:

      在 git 版本 1.7.0 之前,您需要这样做:

      git config branch.master.remote origin
      git config branch.master.merge  refs/head/master
      

      从 git 1.7.0 及更高版本开始,您可以这样做:

      git branch --set-upstream master origin/master
      

      他们做同样的事情。

      【讨论】:

        猜你喜欢
        • 2018-12-07
        • 1970-01-01
        • 1970-01-01
        • 2019-11-17
        • 1970-01-01
        • 1970-01-01
        • 2016-03-31
        • 2018-12-30
        • 1970-01-01
        相关资源
        最近更新 更多