英文:
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,bb
是aaabb 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
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论