使用与本地

时间:2017-06-01 21:40:42

标签: git github

我使用浏览分支下拉列表在github上创建了一个现有PR的新分支...键入一个新的分支名称,以便根据我正在查看的PR创建一个新分支。

然后我去了当地并做了git checkout -b myBranch

如何将我的分支与遥控器同步?我没有将我的本地分支命名为与远程同名。

git push -u origin my_branch - 我假设您已经同步并且本地和远程分支名称完全相同。

那么我的情况呢?

我尝试了这个,但收到了错误

▶git branch --set-upstream-to = origin / feature / WA-3 WA-3 错误:请求的上游分支&origin; / origin / WA-3'不存在

提供更多信息

远程分支的名称为feature/WA-3,而我的本地名称为W3

▶git remote show origin

* remote origin
  Fetch URL: https://github.com/xxxx.git
  Push  URL: https://github.com/xxxx.git
  HEAD branch: develop
  Remote branches:
    develop                         tracked
    feature/WA-3                    new (next fetch will store in remotes/origin)
    master                          tracked
    refs/remotes/origin/w9-homepage stale (use 'git remote prune' to remove)
    w1-log-in              tracked
    wa-9                  tracked
  Local branches configured for 'git pull':
    develop            merges with remote develop
    w1-log-in merges with remote w1-user-can-log-in
    w9-homepage        merges with remote wa-9-homepage
  Local refs configured for 'git push':
    develop            pushes to develop            (up to date)
    w1-log-in pushes to w1-log-in (up to date)

enter image description here

1 个答案:

答案 0 :(得分:6)

使用冒号表示法:

git push -u origin local_branch:remote_branch