如何从gerrit下载/应用所有补丁

huangapple go评论72阅读模式
英文:

How to download/apply all patches from gerrit

问题

你能解释如何同时处理Gerrit中的相同change_id,比如我和另一个人?我们的操作方式都一样:

例如,当我创建补丁集"1"和"3",另外有人创建了补丁集"2",然后我想获取"2",同时仍然保留本地的"1"和"3"。该如何做呢?因为当我通过以下方式下载一个变更时:
git review -d change_id;
我只能看到我的变更"1"和"3",但看不到"2"。谢谢。

英文:

Can you explain how to work with the same change_id in gerrit simultaneously, let's say me and someone else? We are doing all the things the same way:

git review -d change_id;
git add -A;
git commit --amend;
git review branch_name; // push changes to the same branch and change_id

For example, when I create patchset "1" and "3" and someone else patch "2" then I want to fetch "2" and still have "1" and "3" on my local. How to do this? Because when I download a change by:

git review -d change_id;

I can see only my changes "1" and "3" but not "2".
Thank you.

答案1

得分: 1

如果存在第二个补丁集,您可以在change_id之后指定其序号,

git review -d change_id,2

由于git review是第三方命令行工具,可能不可用。我们也可以使用git fetch获取补丁集。每个补丁集都与内部引用相关联,例如refs/changes/bb/aaabb/n,其中aaabb是更改编号或更改ID,bbaaabb mod 100的结果,n是补丁集的序号。

# 假设引用是refs/changes/22/62522/2
git fetch origin refs/changes/22/62522/2
git checkout FETCH_HEAD

# 我们还可以同时创建一个本地分支,例如62522_2
git fetch origin refs/changes/22/62522/2:refs/heads/62522_2
git checkout 62522_2
英文:

If the 2nd patchset does exist, you can specify its ordinal number after the change_id,

git review -d change_id,2

As git review is a third-party command line tool, it may be unavailable. We can also use git fetch to get the patchset. Every patchset is associated with an internal ref like refs/changes/bb/aaabb/n, where aaabb is the change number or change id, bb is the result of aaabb mod 100, and n is the ordinal number of the patchset.

# Suppose the ref is refs/changes/22/62522/2
git fetch origin refs/changes/22/62522/2
git checkout FETCH_HEAD

# We can also create a local branch, for example 62522_2, at the same time
git fetch origin refs/changes/22/62522/2:refs/heads/62522_2
git checkout 62522_2

huangapple
  • 本文由 发表于 2023年6月16日 01:54:41
  • 转载请务必保留本文链接:https://go.coder-hub.com/76484325.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定