问题是我开始研究名为DDH-112
的分支并将其推送到存储库,但后来我使用git branch -m <newname>
更改了该分支的名称,因为前一个是错误的。现在我无法将更改推送到新分支。它说:
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
后出现错误:
! [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 根本没有帮助。我想在推送到新名称分支后有差异。是否可以将这些更改推送到此分支?
首先,命令应该是:
git push -u origin feature/DDH-129-implement-paddings
其次,仅当您使用现有提交的远程分支的名称重命名分支时,错误消息feature/DDH-129-implement-paddings -> feature/DDH-129-implement-paddings (non-fast-forward)
才有意义。
git pull
将提供帮助,前提是关联的远程分支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