We have a repository containing a number of Java projects (~20 or so) built by Maven.
We have 3 branches in our repository, patch
, minor
, a
I usually handle this by committing the code changes for the bug fix as a separate commit(s) from the commit to bump up the version # (which I assume is the change to the pom.xml and MANIFEST files). I can then merge the code change commits into the other branches normally and then lastly "fake" merge the "version # bump" change separately with merge --strategy=ours
.
Op asks:
Our process is: (1) release project 1.3.7 (2) merge the tag into future branches ('minor') (3) update POM/MANIFEST to 1.3.8, (4) ...work... (5) then, a couple weeks later, start back at (1) again.
Okay, my flow was a little different, but following your flow, if step 3 generated commit #1234ABCD, then I would additional do step 3a:
$ git checkout MAINLINE
$ git merge --strategy=ours 1234ABCD
This will ensure that when you loop back arond and hit step #2 in the future, the version # bump will have been considered merged and be ignored.
Alternatively, don't do 3a until later. When you reach step #2 in the future, then do the fake merge of #1234ABCD and then merge all the commits on the branch after #1234ABCD. When you bump the version # in the branch again - "fake merge" it (immediately or later).
The core idea is just to isolate the commit the bumps the version # and "fake" merge it separately - when you do that is up to you. Even if the version # bump is in the middle of the commits on the branch you want to merge, then merge all the other commits before the one that one first, then fake merge the one that bumps the version #, then merge all the commits after that one.
Here's a rough pic of a merge I did last week. Commits down the left margin are MAINLINE development, the ones not on the left margin where made in the RELEASEBRANCH (maintenance branch). The commit order doesn't match your flow, but that doesn't matter.
* bc26f91 Oct 31 Fake merge from IT17p2 to ignore inapplicable commit: All web-apps: blah blah blah (MAINLINE)
|\
| * 3cd69ad Oct 31 All web-apps: bump release # for new release (RELEASEBRANCH)
* | 8eae339 Oct 31 Merge fix from IT17p2: All web-apps: blah blah blah
|\ \
| |/
| * 3612072 Oct 31 All web-apps: blah blah blah
| |