search

Home  >  Q&A  >  body text

怎么拉取git服务器上面的分支到本机?

周末在家里改了下代码,新建了个angular版本的分支,然后pushcoding.net上面了。
今天,到公司却不知道怎么拉取这个angular分支到公司的电脑上面。

求指点,谢谢。。。


已解决,解决方案如下:

首先,我退回版本最初始(因为之前一直改一直改,可能会导致错误)
使用git reset --hard commit_last
接着执行如下:

git>git pull origin angular:angular
error: The following untracked working tree files would be overwritten by merge:

>git checkout angular
error: The following untracked working tree files would be overwritten by checko
ut:

>git clean  -d  -fx ""

然后就可以了!
非常感谢~~~


按1楼的解答得出:

到了代码冲突部分。

天蓬老师天蓬老师2795 days ago791

reply all(3)I'll reply

  • 怪我咯

    怪我咯2017-04-28 09:07:10

    git checkout -b angular
    git pull origin angular
    

    UPDATE

    angular The branch is not developed based on the current branch?
    You can switch back to their common ancestor commit and checkout -b。如果这两个分支完全是不同的 code base, 可以用 git checkout -b --orphan angular to create a brand new branch.

    reply
    0
  • 滿天的星座

    滿天的星座2017-04-28 09:07:10

    git pull <remote host name> <remote branch name>:<local branch name>

    reply
    0
  • 巴扎黑

    巴扎黑2017-04-28 09:07:10

    The method I use is
    1.git fetch origin <远程分支名>
    At this time, there will be a local branch

    Use git branch -r to view, the general result is git branch -r 查看, 一般结果为
    origin/HEAD -> origin/master
    origin/master
    origin/<远程分支名>origin/HEAD -> origin/master

    origin/master

    origin/<Remote branch name>
    git checkout -b <本地分支名> origin/<远程分支名>2. Create a new branch locally and put this branch into it

    🎜🎜

    reply
    0
  • Cancelreply