如何在github中合并主分支和下一个分支

如何在github中合并主分支和下一个分支,git,github,opentsdb,Git,Github,Opentsdb,有一个主分支: 下一个分支: 我需要克隆主机,下载下一个分支,合并它们并构建它们: 我试过这个: 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

有一个主分支:

下一个分支:

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

我试过这个:

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
javac:未找到文件:src/query/TagVFilter.java
用法:javac
使用-help获取可能选项的列表
make[1]:***[.javac stamp]错误2
make[1]:离开目录“/app/data.3/opentsdb/build”
make:**[全部]错误2
如何在github中合并主分支和下一个分支?

TL;博士 我建议将分支
next
合并到其中,手动解决冲突

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
master
早了196次提交。但是,

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
的共同祖先。可能是修补程序。你几乎没有什么工作要做。

但是你丢失了哪些文件?您输出的Java错误可能与git命令无关。运行git命令时是否会出现任何错误?获取和合并会发生什么?@bitoiu,获取和合并没有任何错误。我甚至可以肯定,我做得对。你能帮忙吗?我需要在本地合并next和master并构建它。尝试在两个未合并的分支上运行
javac
。它成功了吗?@NickVolynkin,它不是javac。我无法在本地合并master和next。我需要帮助克隆主机,然后再合并它们。我们的策略是什么?它会盲目地合并文件并使其不可编译吗?没有使用git自动更新的方法?我很抱歉。我的意思是说,我不熟悉下一步与master合并。好的,在执行签出或合并之前,我不需要先克隆它吗?让我们来。