Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux 如何在gerrit中创建合并补丁和合并补丁之前的依赖关系?_Linux_Git_Dependencies_Patch_Gerrit - Fatal编程技术网

Linux 如何在gerrit中创建合并补丁和合并补丁之前的依赖关系?

Linux 如何在gerrit中创建合并补丁和合并补丁之前的依赖关系?,linux,git,dependencies,patch,gerrit,Linux,Git,Dependencies,Patch,Gerrit,我在gerrit上有两个补丁,我想让未合并的补丁依赖于合并的补丁 两个都上传到gerrit了 我怎么做?有可能吗 我可以通过gerrit来做吗?不通过和樱桃采摘 假设是未合并的文件 Gerrit中合并的文件依赖项只是Git树图的一种表示。因此,要使变更B依赖于变更A,B必须将A作为其父项 在您的例子中,在两个不同的存储库中有两个更改。Gerrit当前不支持跨存储库依赖项。然而,这是一个很好的解决方案,上周末Gerrit用户会议上刚刚讨论过。希望在Gerrit的未来版本中添加对跨存储库依赖关系

我在gerrit上有两个补丁,我想让未合并的补丁依赖于合并的补丁

两个都上传到gerrit了

  • 我怎么做?有可能吗

  • 我可以通过gerrit来做吗?不通过和樱桃采摘

假设是未合并的文件


Gerrit中合并的文件

依赖项只是Git树图的一种表示。因此,要使变更B依赖于变更A,B必须将A作为其父项


在您的例子中,在两个不同的存储库中有两个更改。Gerrit当前不支持跨存储库依赖项。然而,这是一个很好的解决方案,上周末Gerrit用户会议上刚刚讨论过。希望在Gerrit的未来版本中添加对跨存储库依赖关系的支持。

使用取自以下位置的git命令:


抱歉-就像我上面说的,你想做的事情在Gerrit中目前是不可能的。这是开发人员正在思考和研究的问题。很多用户都想这么做,但现在不行。我是说在git中。。。因此,如果有人寻找这个问题,他将看到一个解决方案。在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`