【问题标题】:git fetch only tip of branchgit 仅获取分支的尖端
【发布时间】:2018-06-22 10:24:41
【问题描述】:
git init
git remote add production "ssh://domain.com/foo.git/"
git fetch origin
npm install --production --silent

问题是git fetch 似乎获取了很多提交。

我只想从源远程获取主分支的提示。有谁知道只从某个分支获取最新的提交?

【问题讨论】:

  • 见“浅克隆”;注意git fetch 也允许--depth
  • 是的,我再次查看了git fetch 文档,是的

标签: git git-fetch


【解决方案1】:

由于您是从远程源获取更改,因此您可以运行以下单行代码:

git clone ssh://domain.com/foo.git --depth=1

【讨论】:

    【解决方案2】:

    看起来像

    git fetch origin master --depth=1
    

    似乎有效

    【讨论】:

      猜你喜欢
      • 2017-12-23
      • 2012-11-04
      • 1970-01-01
      • 1970-01-01
      • 2012-03-21
      • 2012-10-23
      相关资源
      最近更新 更多