Discuss / Git / 发现一个问题

发现一个问题

Topic source

kkoang

#1 Created at ... [Delete] [Delete and Lock User]

总结的时候用的是:git branch --set-upstream-to <branch-name> origin/<branch-name> 但是教程用的是git branch --set-upstream-to origin/<branch-name> <branch-name> 不知道前后顺序会不会影响。

xinnong2345

#2 Created at ... [Delete] [Delete and Lock User]

结论:

1、git branch --set-upstream-to origin/<branch-name> <branch-name>这个是正确的,也可以写成git branch --set-upstream-to=origin/<branch> <branch-name>。

2、git branch --set-upstream-to=origin/<branch> <branch-name>这种写法是git pull时没有关联信息的话给出的提示写法。

具体实验步骤:注意粗体部分

lenovo@lenovo-PC MINGW32 /d/gitee/GitPractice (feature-a)

$ git branch -vv

* feature-a 0afc783 make some changes

  master    ec1d085 [origin/master] process conflict

lenovo@lenovo-PC MINGW32 /d/gitee/GitPractice (feature-a)

$ git pull

remote: Enumerating objects: 4, done.

remote: Counting objects: 100% (4/4), done.

remote: Compressing objects: 100% (2/2), done.

remote: Total 3 (delta 1), reused 0 (delta 0)

Unpacking objects: 100% (3/3), done.

From oschina:dingdongfm/GitPractice

 * [new branch]      hpp        -> origin/hpp

There is no tracking information for the current branch.

Please specify which branch you want to merge with.

See git-pull(1) for details.

    git pull <remote> <branch>

If you wish to set tracking information for this branch you can do so with:

**    git branch --set-upstream-to=origin/<branch> feature-a**

lenovo@lenovo-PC MINGW32 /d/gitee/GitPractice (feature-a)

$ git branch --set-upstream-to feature-a origin/feature-a

fatal: branch 'origin/feature-a' does not exist

lenovo@lenovo-PC MINGW32 /d/gitee/GitPractice (feature-a)

$ git branch --set-upstream-to origin/feature-a feature-a

Branch feature-a set up to track remote branch feature-a from origin.

lenovo@lenovo-PC MINGW32 /d/gitee/GitPractice (feature-a)

$ git branch -vv

* feature-a 0afc783 [origin/feature-a] make some changes

  master    ec1d085 [origin/master] process conflict


  • 1

Reply