使用单个命令获取远程服务器中的所有更改 [英] fetch all changes in remote server using single command

查看:115
本文介绍了使用单个命令获取远程服务器中的所有更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我习惯于不添加远程git-hub服务器,而是直接执行获取操作。



当我做时

  git fetch url //不会从远程获取所有更改$ b $ git remote add origin url 
git fetch origin //从远程获取所有更改

是否有任何命令可以使用单个命令获取远程中的所有更改。
在获取url和获取原点之间也有区别。

解决方案

这是因为 refspec 当你做一个 git remote add

  remote.origin.url=git@github.com:<用户名> /< reponame> 
remote.origin.fetch = + refs / heads / *:refs / remotes / origin / *






  • 它会提取所有
  • 将它们放入您的本地克隆的回购库中 remotes / origin /

  • ul>

    (正如我在这个答案中提到的那样)



    直接使用url时,本地配置中没有respec指示Git要获取什么。


    I have the habit of not adding remote git-hub server and instead directly do the fetch

    when i do

    git fetch url //does not fetch all the changes from remote
    git remote add origin url 
    git fetch origin //fetches all the changes from remote
    

    Is there any command such that,fetch all changes in remote using single command. Also difference between fetch url and fetch origin.

    解决方案

    This is because of the refspec added when you do a git remote add.

    remote.origin.url=git@github.com:<username>/<reponame>
    remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
    

    That refspec will instruct git what to fetch and where:

    • it fetches all heads and
    • put them in your local cloned repo in remotes/origin/

    (as I mentioned it also in this answer)

    When you use the url directly, there is no respec in the local config to instruct Git what to fetch.

    这篇关于使用单个命令获取远程服务器中的所有更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆