如何在Bitbucket上重命名分支后推送更改? [英] How to push changes after rename branch on Bitbucket?
问题描述
问题是我开始在名为 DDH-112
的分支上工作,并将其推送到存储库,但是随后我使用 git branch -m< newname>更改了该分支的名称.;
,因为上一个是错误的.现在,我无法将更改推送到新分支.它说:
The problem is that I started working on branch called DDH-112
and I pushed it to the repository but then I changed name of this branch by using git branch -m <newname>
because the previous one was wrong. Now I can't push changes to the new branch. It says:
fatal: The upstream branch of your current branch does not match
the name of your current branch. To push to the upstream branch
on the remote, use
git push origin HEAD:DDH-122
To push to the branch of the same name on the remote, use
git push origin feature/DDH-129-implement-paddings
执行 git push origin feature/DDH-129-implement-paddings
后,出现错误:
![已拒绝]功能/DDH-129实现填充->功能/DDH-129实现填充(非快进)错误:无法将一些引用推送到'git@bitbucket.org:apptension/dontdrivehigh.git'提示:更新被拒绝,因为当前分支的尖端在后面提示:它的远程副本.集成远程更改(例如提示:"git pull ..."),然后再次按下.提示:有关详细信息,请参见"git push --help"中的关于快进的注意事项".
git pull根本没有帮助.推送到新名称分支后,我希望拥有差异.是否可以将这些更改推送到该分支?
! [rejected] feature/DDH-129-implement-paddings -> feature/DDH-129-implement-paddings (non-fast-forward)
error: failed to push some refs to 'git@bitbucket.org:apptension/dontdrivehigh.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
git pull doesn't help at all. I would like to have the Difference after pushing to the new-name branch. Is it possible to push these changes to this branch?
推荐答案
首先,命令应为:
git push -u origin feature/DDH-129-implement-paddings
第二,错误消息 feature/DDH-129-implement-paddings->仅当您使用已经存在的具有提交的远程分支的名称重命名分支时,feature/DDH-129-implement-paddings(非快进)
才有意义.
Second, the error message feature/DDH-129-implement-paddings -> feature/DDH-129-implement-paddings (non-fast-forward)
makes sense only if you rename your branch with a name of a remote branch already existing, with existing commits.
git pull
将提供帮助,前提是关联的远程分支是 feature/DDH-129-工具填充
:
git pull
will help, provided the associated remote branch is feature/DDH-129-implement-paddings
:
git fetch
git branch -u origin/feature/DDH-129-implement-paddings feature/DDH-129-implement-paddings
git pull
# resolve conflicts
git push
这篇关于如何在Bitbucket上重命名分支后推送更改?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!