GitHub入门与实践(2)掌握Git 5、从远程仓库获取

    1)获取远程仓库 
        git clone
        $ git clone git@github.com:jamsonwoo/git-tutorial.git
        Cloning into 'git-tutorial'...
        Enter passphrase for key '/c/Documents and Settings/Administrator/.ssh/id_rsa':

        remote: Counting objects: 20, done.
        remote: Compressing objects: 100% (6/6), done.
        remote: Total 20 (delta 3), reused 20 (delta 3), pack-reused 0
        Receiving objects: 100% (20/20), done.
        Resolving deltas: 100% (3/3), done.
        Checking connectivity... done
        $ cd git-tutorial/
        $ git branch -a
        * master
          remotes/origin/HEAD -> origin/master
          remotes/origin/feature-D
          remotes/origin/master
        $ git checkout -b feature-D origin/feature-D
        Branch feature-D set up to track remote branch feature-D from origin.
        Switched to a new branch 'feature-D'
        $ git diff
        diff --git a/README.md b/README.md
        index c194c43..617cdfb 100644
        --- a/README.md
        +++ b/README.md
        @@ -2,4 +2,5 @@

           - feature-A
           - fix-B
        -  - feature-C
        \ No newline at end of file
        +  - feature-C
        +  - feature-D
        \ No newline at end of file
        $ git commit -am "Add feature-D"
        [feature-D 3b33297] Add feature-D
         1 file changed, 2 insertions(+), 1 deletion(-)
        $ git push
        Counting objects: 5, done.
        Delta compression using up to 2 threads.
        Compressing objects: 100% (2/2), done.
        Writing objects: 100% (3/3), 280 bytes | 0 bytes/s, done.
        Total 3 (delta 0), reused 0 (delta 0)
        To git@github.com:jamsonwoo/git-tutorial.git
           b306656..3b33297  feature-D -> feature-D
    2)获取最新的远程仓库分支
        git pull
        $ cd ../../git-tutorial
        $ git pull origin feature-D
        Enter passphrase for key '/c/Documents and Settings/Administrator/.ssh/id_rsa':

        remote: Counting objects: 3, done.
        remote: Compressing objects: 100% (2/2), done.
        remote: Total 3 (delta 0), reused 3 (delta 0), pack-reused 0
        Unpacking objects: 100% (3/3), done.
        From github.com:jamsonwoo/git-tutorial
         * branch            feature-D  -> FETCH_HEAD
           b306656..3b33297  feature-D  -> origin/feature-D
        Updating b306656..3b33297
        Fast-forward
         README.md | 3 ++-
         1 file changed, 2 insertions(+), 1 deletion(-)

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值