Git Flow with gitflow-maven-plugin
Quick Guide!!!!!
<plugin>
<groupId>com.amashchenko.maven.plugin</groupId>
<artifactId>gitflow-maven-plugin</artifactId>
<version>1.14.0</version>
<configuration>
<installProject>false</installProject>
<verbose>false</verbose>
<keepBranch>true</keepBranch>
<skipTestProject>true</skipTestProject>
<gitFlowConfig>
<productionBranch>master</productionBranch>
<developmentBranch>develop</developmentBranch>
<featureBranchPrefix>feature/</featureBranchPrefix>
<releaseBranchPrefix>release/</releaseBranchPrefix>
<hotfixBranchPrefix>hotfix/</hotfixBranchPrefix>
<versionTagPrefix></versionTagPrefix>
<origin>origin</origin>
</gitFlowConfig>
<commitMessages>
<!-- since 1.2.1, see Customizing commit messages -->
</commitMessages>
</configuration>
</plugin>
- Start Develop the new Feature
chiwa@MacBook-Pro my-service % mvn gitflow:feature-start
[INFO] Scanning for projects…
[WARNING]
……..
[INFO] — — gitflow-maven-plugin:1.14.0:feature-start (default-cli) @ my-service — -
[INFO] Checking for uncommitted changes.
[INFO] Fetching remote branch ‘origin develop’.
[INFO] Comparing local branch ‘develop’ with remote ‘origin/develop’.
What is a name of feature branch? features/:
Input the Feature Branch Name. I will input “test” for this.
What is a name of feature branch? features/: test
[INFO] Creating a new branch ‘features/test’ from ‘develop’ and checking it out.
[INFO] Updating version(s) to ‘1.0.2-test-SNAPSHOT’.
[INFO] Committing changes.
[INFO] — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —
[INFO] BUILD SUCCESS
[INFO] — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —
[INFO] Total time: 03:18 min
[INFO] Finished at: 2019–12–12T11:05:43+07:00
[INFO] — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —
Verify the Feature Branch is created or not?
chiwa@MacBook-Pro my-service % git branch
develop
* features/test
master
When the implementation is done, It’s the time for finish the feature
chiwa@MacBook-Pro my-service % mvn gitflow:feature-finish
[INFO] Scanning for projects…
[WARNING]
[WARNING] Some problems were encountered while building the effective model for my-service:jar:1.0.2-test-SNAPSHOT
…
[INFO] — — gitflow-maven-plugin:1.14.0:feature-finish (default-cli) @ my-service — -
[INFO] Checking for uncommitted changes.
Feature branches:
1. features/test
Choose feature branch to finish (1): 1
[INFO] Fetching remote branch ‘origin features/test’.
[INFO] Comparing local branch ‘features/test’ with remote ‘origin/features/test’.
[INFO] Fetching remote branch ‘origin develop’.
[INFO] Comparing local branch ‘develop’ with remote ‘origin/develop’.
[INFO] Checking out ‘develop’ branch.
[INFO] Merging ( — no-ff) ‘features/test’ branch.
[INFO] Updating version(s) to ‘1.0.2-SNAPSHOT’.
[INFO] Committing changes.
[INFO] Pushing ‘develop’ branch to ‘origin’.
[INFO] — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —
[INFO] BUILD SUCCESS
[INFO] — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —
[INFO] Total time: 26.384 s
[INFO] Finished at: 2019–12–12T11:12:13+07:00
[INFO] — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —
chiwa@MacBook-Pro my-service % git branch
* develop
features/test
master
chiwa@MacBook-Pro my-service %
2. Release New Feature (including test)
2.1 mvn gitflow:release-start
chiwa@MacBook-Pro my-service % mvn gitflow:release-start
[INFO] Scanning for projects…
….
[INFO] Building my-service 1.0.2-SNAPSHOT
[INFO] — — — — — — — — — — — — — — — — [ jar ] — — — — — — — — — — — — — — — — -
[INFO]
[INFO] — — gitflow-maven-plugin:1.14.0:release-start (default-cli) @ my-service — -
[INFO] Checking for uncommitted changes.
[INFO] Fetching remote branch ‘origin develop’.
[INFO] Comparing local branch ‘develop’ with remote ‘origin/develop’.
[INFO] Checking out ‘develop’ branch.
[INFO] Checking for SNAPSHOT versions in dependencies.
What is release version? [1.0.2]:
[INFO] Version is blank. Using default version.
[INFO] Creating a new branch ‘release/1.0.2’ from ‘develop’ and checking it out.
[INFO] Updating version(s) to ‘1.0.2’.
[INFO] Committing changes.
[INFO] — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —
[INFO] BUILD SUCCESS
[INFO] — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —
[INFO] Total time: 46.288 s
[INFO] Finished at: 2019–12–12T11:20:26+07:00
[INFO] — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —
chiwa@MacBook-Pro my-service % git branch
develop
features/test
master
* release/1.0.2
2.2 mvn gitflow:realease-finish
chiwa@MacBook-Pro my-service % mvn gitflow:release-finish
[INFO] Scanning for projects…
[WARNING]
[WARNING] Some problems were encountered while building the effective model for my-service:jar:1.0.2
[INFO] Building my-service 1.0.2
[INFO] — — — — — — — — — — — — — — — — [ jar ] — — — — — — — — — — — — — — — — -
[INFO]
[INFO] — — gitflow-maven-plugin:1.14.0:release-finish (default-cli) @ my-service — -
[INFO] Checking for uncommitted changes.
[INFO] Checking out ‘release/1.0.2’ branch.
[INFO] Checking for SNAPSHOT versions in dependencies.
[INFO] Fetching remote branch ‘origin release/1.0.2’.
[WARNING] There were some problems fetching remote branch ‘origin release/1.0.2’. You can turn off remote branch fetching by setting the ‘fetchRemote’ parameter to false.
[INFO] Fetching remote branch ‘origin develop’.
[INFO] Comparing local branch ‘develop’ with remote ‘origin/develop’.
[INFO] Fetching remote branch ‘origin master’.
[INFO] Comparing local branch ‘master’ with remote ‘origin/master’.
[INFO] Checking out ‘release/1.0.2’ branch.
[INFO] Checking out ‘master’ branch.
[INFO] Merging ( — no-ff) ‘release/1.0.2’ branch.
[INFO] Creating ‘1.0.2’ tag.
[INFO] Checking out ‘develop’ branch.
[INFO] Merging ( — no-ff) ‘release/1.0.2’ branch.
[INFO] Updating version(s) to ‘1.0.3-SNAPSHOT’.
[INFO] Committing changes.
[INFO] Pushing ‘master’ branch to ‘origin’.
[INFO] Pushing ‘develop’ branch to ‘origin’.
[INFO] — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —
[INFO] BUILD SUCCESS
[INFO] — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —
[INFO] Total time: 17.184 s
[INFO] Finished at: 2019–12–12T11:24:58+07:00
[INFO] — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —
chiwa@MacBook-Pro my-service % git branch
* develop
features/test
master