how do you merge master and next branch in github

595 views Asked by At

There is a master branch:

https://github.com/OpenTSDB/opentsdb

and a next branch:

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

I need to clone master, download the next branch, merge them and build them:

I've tried this:

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

When I'm trying to build the final code, I get this error:

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

How do you merge master and next branch in github?

1

There are 1 answers

4
Nick Volynkin On

TL;DR

I would suggest taking the branch next and merge master into it, manually resolving conflicts.

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

Now there are some conflicts in, it should be, 3 files: NEWS, configure.ac, src/core/AggregationIterator.java. You have to resolve them manually.

It appears that AggregationIterator.java gets merged automatically.

Long essay on research of this particular repository and possible merges.

The following command

git diff --stat next > diff.txt

Gives us:

157 files changed, 5924 insertions(+), 22414 deletions(-)

So the branches should probably be merged manually.

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

Output is 196 lines. That means that next has gone 196 commits ahead of master since branching. However,

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

is just 7 lines:

* 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.

The merge-base of two commits is dcf516f96ed10ce0b95b1e62847fbead723b87e1.

git diff dcf516f96ed10ce0b95b1e62847fbead723b87e1

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

So, you only have three files that were changed in master since their common ancestor with next. Probably hotfixes. You've got very little work to do.