I have a Git repository containing a Java library with two branches: main and jdk8.
The jdk8 branch is the main development branch, with all changes merged into main, whereas the main branch is modular and based on jdk11, with module-info.java files and changes in Gradle build files, different build plugins and modular versions of dependencies, where available. The source code itself is close to identical between the two branches.
What I'd like to do, is to stop developing on the jdk8 branch and start using main as the main development branch, merging changes into the jdk8 branch, from there on.
Some googling led me to these:
How to make empty merge commit (ignoring changes)?
Git - Ignore files during merge
And from that I came up with this strategy:
git checkout jdk8
git merge -s ours main
I have tested this and it looks like it works as expected, that is, allows me to start developing on main and merge the changes into the jdk8 branch, excluding any modified files that don't belong there during merge (perhaps I can use git attributes to exclude the module-info.java files automatically, for example).
On the face of it, this appears quite manageable, but since my understanding of Git is quite rudimentary, I'm wondering if this will cause some problems down the road, is there perhaps a better ("correct" even?) way of doing this?