我在gerrit
上有两个补丁,我想让未合并的补丁在合并的补丁上完成。
两者都已上传到gerrit。
我该怎么办?有可能吗?
我可以通过gerrit做到吗?不是通过git和樱桃选择。
答案 0 :(得分:3)
Gerrit中的依赖关系只是Git树图的表示。因此,要使变更B取决于变更A,B必须将A作为其父项。
在您的情况下,您在两个不同的存储库中进行了两处更改。 Gerrit目前不支持跨存储库依赖项。然而,这是一个commonly-requested feature,上周末在Gerrit用户大会上进行了讨论。希望在Gerrit的未来版本中添加对跨存储库依赖项的支持。
答案 1 :(得分:2)
使用取自here的git命令:
git fetch --all # Make sure we have latest info from the repository
git review -d 1234 # Gerrit change number of the change you want as dependency ("parent")
git checkout -b bug/1234 # Creates a new branch, with the current branch (the dependency) as parent
# Edit files: make your changes
git add someFile.php some/other/file.js
git commit # Commit your patch
git log -n5 --decorate --pretty=oneline # Verify that the last 5 entries of the log now start with:
# * (HEAD, bug/1234) your change
# * (review/john/700) the dependency
# * (gerrit/master)
git push gerrit HEAD:refs/for/master # Use this instead of `git review`
git branch # Take note of the review/* branch that was created for this, it has an "*" in front of it
git checkout bug/1234 # Check out the local topic branch of your change
git rebase review/john/7000 # The branch name of the gerrit change we checked out earlier
# Resolve conflicts if needed,
# - use "git status" to see the files that need resolution
# - after fixing it in your editor, "git add filename" for each of the fixed files
git commit --amend -c HEAD # Re-commit your patch replacing the one with the wrong parent
git log -n5 --decorate --pretty=oneline # Verify that the last 5 entries of the log now start with:
# * (HEAD, bug/1234) your change
# * (review/john/700) the dependency
# * (gerrit/master)
git push gerrit HEAD:refs/for/master # Use this instead of `git review`