码迷,mamicode.com
首页 > 其他好文 > 详细

git杂记-远程仓库的使用

时间:2017-04-03 18:42:50      阅读:165      评论:0      收藏:0      [点我收藏+]

标签:fetch   添加   add   clone   git   sch   pre   web   ...   

  1. 查看远程仓库;克隆自己的仓库,如不命名则默认远程仓库名字为origin;
    $ git clone https://github.com/OuFeng/JF_WEB.git
    Cloning into ticgit...
    remote: Reusing existing pack: 1857, done.
    remote: Total 1857 (delta 0), reused 0 (delta 0)
    Receiving objects: 100% (1857/1857), 374.35 KiB | 268.00 KiB/s, done.
    Resolving deltas: 100% (772/772), done.
    Checking connectivity... done.
    $ cd ticgit
    $ git remote -v         --查看本地仓库中对应有哪些远程仓库;如果远程仓库不止有一个的话,则会列出多个仓库。

      origin https://github.com/OuFeng/JF_WEB.git (fetch)
      origin https://github.com/OuFeng/JF_WEB.git (push)

     

  2. 添加远程仓库;名称为pb。
    $ git remote
    origin
    $ git remote add pb https://github.com/paulboone/ticgit
    $ git remote -v
    origin    https://github.com/schacon/ticgit (fetch)
    origin    https://github.com/schacon/ticgit (push)
    pb    https://github.com/paulboone/ticgit (fetch)
    pb    https://github.com/paulboone/ticgit (push)

     

  3. 从远程仓库抓取与拉取。
    --抓取origin远程库的所有分支;只抓取数据,并不自动合并;
    $ git fetch origin
    --拉取origin远程库的所有分支;只抓取数据,自动合并;
    $ git pull origin

     

  4. 推送到远程仓库;推送到origin仓库的master分支;
    $ git push origin master

     

  5. 查看远程仓库,查看origin仓库的更多信息
    $ git remote show origin

     

  6. 远程仓库的重命名和删除
    --把远程仓库pb重命名为paul
    $ git remote rename pb paul
    
    
    --删除paul远程分支的引用
    $ git remote rm paul

     

git杂记-远程仓库的使用

标签:fetch   添加   add   clone   git   sch   pre   web   ...   

原文地址:http://www.cnblogs.com/oufeng/p/6662931.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!