我在github上使用下拉菜单从现有PR中创建了一个新分支...输入一个新的分支名称,以便基于我查看的PR创建一个新分支。
然后我在本地执行了git checkout -b myBranch
如何将我的分支与远程同步?我没有将本地分支命名为与远程相同的名称。
git push -u origin my_branch
- 我假设这是在已经同步且本地和远程分支名称完全相同时可以使用的命令。
那么对于我的情况呢?
我尝试过这个但是出现了错误
▶ git branch --set-upstream-to=origin/feature/WA-3 WA-3 error: the requested upstream branch 'origin/feature/WA-3' does not exist
更多信息以帮助解决问题
远程分支的名称是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)