美文网首页git
Git 教程(三)--远程仓库

Git 教程(三)--远程仓库

作者: 2012lc | 来源:发表于2017-09-26 15:38 被阅读74次

    前言

    Git 教程(一)--Git简介及操作流程
    Git 教程(二)--Git文件操作
    Git 教程(三)--远程仓库
    Git 教程(四)--分支原理
    Git 教程(五)--远程分支

    远程仓库

    在第一篇文章中已经新建了一个远程仓库,我们在这里就不再次新建仓库(git remote add <shortname> <url>
    添加一个新的远程 仓库,同时指定一个你可以轻松引用的简写)了。

    从远程仓库中克隆

    git clone + url

    clone.png

    从远程仓库中拉取

    git fetch [remote-name]
    使用git fetch从远程仓库中拉取数据过后,并不会主动的合并或者修改你当前的工作,必须手动将其合并到你的工作当中,得使用git merge来合并。当然可以直接使用git pull来直接拉取合并。

    git pull.png

    推送到远程仓库

    git push [remote-name] [branch-name]

    git push.png

    在实际工作时,你和别人同时克隆,并且他先将内容推送到github上时,你并不能直接推送上你的内容,你得先拉取合并再推送上去自己的内容。因为这样能够很好的避免冲突。

    查看远程仓库

    git remote show [remote-name]

    git remote show .png

    远程仓库的移除

    git remote rm

    远程仓库的重命名

    git remote rename

    相关文章

      网友评论

        本文标题:Git 教程(三)--远程仓库

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