使现有的Git分支连接到源而不是上游

时间:2014-09-04 03:25:49

标签: git

我最近分配了一个项目并坚持了一个问题。

我有以下遥控器:

$ git remote -v
origin  git@github.com:Hesamedin/passenger-android.git (fetch)
origin  git@github.com:Hesamedin/passenger-android.git (push)
upstream        git@github.com:mycompany/passenger-android.git (fetch)
upstream        git@github.com:mycompany/passenger-android.git (push)

我想我使用了错误的命令并将我的v2_dev barach连接到上游。现在我想将它连接到原点。命令是什么?我应该改变吗?

我在v2_dev本地分支

$ git branch -r
  origin/HEAD -> origin/v2_dev
  origin/gh-pages
  origin/master
  origin/mvn-repo
  upstream/v2_dev

1 个答案:

答案 0 :(得分:0)

好的,我为修复我的本地问题所做的是:

$ git fetch
Enter passphrase for key '/c/Users/Hesam/.ssh/id_rsa':
From github.com:Hesamedin/passenger-android
 * [new branch]      v2_dev     -> origin/v2_dev

$ git branch -r
  origin/HEAD -> origin/v2_dev
  origin/gh-pages
  origin/master
  origin/mvn-repo
  origin/v2_dev
  upstream/v2_dev

$  git branch -u origin v2_dev
Branch v2_dev set up to track remote branch v2_dev from origin by rebasing.

$ git branch -r
  origin/HEAD -> origin/v2_dev
  origin/gh-pages
  origin/master
  origin/mvn-repo
  origin/v2_dev
  upstream/v2_dev

然后我将上游/ v2_dev合并到origin / v2_dev并删除了上游/ v2_dev。

似乎一切都还好。