用于将本地提交推送到不同远程分支的 git push 命令 [英] git push command for pushing a local commit to a different remote branch

查看:78
本文介绍了用于将本地提交推送到不同远程分支的 git push 命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我同步到一个 repo 树,它是分支jb"......我在这个分支上有一个本地提交,我试图推送到远程分支jb_mr2"并遇到以下错误......是否有 git我可以使用 push 命令将此本地提交推送到jb_mr2"

I synced to a repo tree which is branch "jb"... I have a local commit on this branch which I am trying to push to a remote branch "jb_mr2" and running into following error..is there a git push command which I can use to push this local commit to "jb_mr2"

terminal3{73}> git push ssh://company.com:29418/platform/vendor/com-proprietary/ship/ftm 72bc75e409e50dcad29bd790b4b6478dc6668f12:refs/for/jb_mr2
Counting objects: 9, done.
Delta compression using up to 32 threads.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (6/6), 7.01 KiB, done.
Total 6 (delta 3), reused 0 (delta 0)
remote: Resolving deltas: 100% (3/3)
remote: Processing changes: refs: 1, done   
To ssh://company.com:29418/platform/vendor/com-proprietary/ship/ftm
 ! [remote rejected] 72bc75e409e50dcad29bd790b4b6478dc6668f12 -> refs/for/jb_mr2 (branch jb_mr2 not found)
error: failed to push some refs to 'ssh://company.com:29418/platform/vendor/com-proprietary/ship/ftm'

推荐答案

我能够多玩一点,并有更好的解决方案.如果我没看错,远程分支jb_mr2"已经存在.从带有提交的本地分支运行:

I was able to play with this a bit more and have a better solution. If I read you correctly, the remote branch "jb_mr2" already exists. From the local branch with the commits run this:

git push ssh://company.com:29418/platform/vendor/com-proprietary/ship/ftm 72bc75e409e50dcad29bd790b4b6478dc6668f12:jb_mr2

如果遥控器不存在:

git push ssh://company.com:29418/platform/vendor/com-proprietary/ship/ftm 72bc75e409e50dcad29bd790b4b6478dc6668f12:/refs/heads/jb_mr2

这篇关于用于将本地提交推送到不同远程分支的 git push 命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆