git 正在更新 gerrit 服务器上的两个分支

问题描述 投票:0回答:1

当我这样做时

git push origin HEAD:refs/for/main
,更改将被推送到两个分支。我怎样才能推送到我的分支?我的本地设置有些混乱..我不想将任何改变推到
287913

remote: 
remote:   https://git.team.com/r/c/product/+/287913 [wip] CI work
remote: 
remote: The following approvals got outdated and were removed:
remote: * Verified-1 by svc
remote: 
remote:   https://git.team.com/r/c/product/+/290536 [base image layers] port logic
remote: 
remote: The following approvals got outdated and were removed:
remote: * Verified-1 by svc
remote: 
remote: 
git gerrit
1个回答
0
投票

在 1 次推送中创建/更新 2 个待定更改意味着您有 2 个连续的新提交。一个对应287913,另一个对应290536。如果它们不相互依赖,你可以将它们拆分到2个本地开发分支。

在 Gerrit Change 页面上检查他们的提交。假设 287913 是

abc123
,290536 是
xyz789

# Create 2 local dev branches for each change
git fetch origin main
git branch dev_287913 FETCH_HEAD
git branch dev_290536 FETCH_HEAD

# Apply the 2 commits onto the dev branches
git switch dev_287913
git cherry-pick abc123
git switch dev_290536
git cherry-pick xyz789

如果有任何冲突,请解决。这 2 个更改仍然处于开放状态,因此您可以对其进行修改,并在必要时推送更新待处理的更改。

© www.soinside.com 2019 - 2024. All rights reserved.