0

有一个主分支:

https://github.com/OpenTSDB/opentsdb

和下一个分支:

https://github.com/OpenTSDB/opentsdb/tree/next

我需要克隆 master,下载下一个分支,合并它们并构建它们:

我试过这个:

git clone https://github.com/OpenTSDB/opentsdb.git --depth=1  -b next

cd opentsdb/

git fetch origin master:master --depth=1

git merge -s ours master

当我尝试构建最终代码时,出现此错误:

javac: file not found: src/query/TagVFilter.java
Usage: javac <options> <source files>
use -help for a list of possible options
make[1]: *** [.javac-stamp] Error 2
make[1]: Leaving directory `/app/data.3/opentsdb/build'
make: *** [all] Error 2

如何在 github 中合并 master 和 next 分支?

4

1 回答 1

2

TL;博士

我建议将分支next合并master到其中,手动解决冲突。

git clone https://github.com/OpenTSDB/opentsdb.git
cd opentsdb
git checkout -b next origin/next
git checkout master
git merge next

现在应该是 3 个文件中存在一些冲突:NEWS, configure.ac, src/core/AggregationIterator.java. 您必须手动解决它们

似乎AggregationIterator.java会自动合并。

关于这个特定存储库和可能合并的研究的长文。

以下命令

git diff --stat next > diff.txt

给我们:

157 个文件更改,5924 个插入(+),22414 个删除(-)

所以分支可能应该手动合并。

git log --oneline --graph --decorate master..next > master_next.txt

输出为 196 行。这意味着自分支以来next已经进行了 196 次提交。master然而,

git log --oneline --graph --decorate next_master > next_master.txt

只有 7 行:

* 45e575a (HEAD, origin/master, origin/HEAD, master) Improve query performance in the AggregationIterator by calling .hasNext() on the downsampler instead of letting it build a giant exception string that we're just tossing in the bit bucket.
* 248fee6 (tag: v2.1.0) Release version 2.1.0
* bb061c7 Merge branch 'next'
* 7129df4 (origin/maintenance) Remove links to the old Google code repo in the third party includes.
* 791c9e3 Cleanup the Config class a bit. Make sure to close the conig file after opening and add more unit tests.
* 2b5b5f3 Add unit tests for config directory fix Move null check to top of config directory parsing so that it will take care of Windows systems as well
* 11ac8f3 Fixed issue throwing a null exception when a config directory is null.

两个提交的合并基础是dcf516f96ed10ce0b95b1e62847fbead723b87e1.

git diff dcf516f96ed10ce0b95b1e62847fbead723b87e1

 NEWS                              | 16 ++++++++++++++--
 configure.ac                      |  2 +-
 src/core/AggregationIterator.java |  9 ++-------
 3 files changed, 17 insertions(+), 10 deletions(-)

因此,您只有三个文件master自它们的共同祖先与next. 应该是修补程序。你要做的工作很少。

于 2015-06-11T20:08:44.457 回答