aleksandr-m / gitflow-maven-plugin

The Git-Flow Maven Plugin supports various Git workflows, including GitFlow and GitHub Flow. This plugin runs Git and Maven commands from the command line.
https://aleksandr-m.github.io/gitflow-maven-plugin/
Apache License 2.0
488 stars 180 forks source link

hotfix-finish throws fatal:refusing to merge unrelated histories #316

Closed vinukm closed 2 years ago

vinukm commented 2 years ago

I am trying to run the hotfix start and finish with the help of GitHub Actions workflows. The hotfix-start workflow creates the hotfix branch fine. The workflow setup for hotfix-finish fails with the error: Error: Failed to execute goal com.amashchenko.maven.plugin:gitflow-maven-plugin:1.16.0:hotfix-finish (default-cli) on project <xyz>: hotfix-finish: fatal: refusing to merge unrelated histories at the step where the plugin tries merging hotfix branch into the master branch within the runner. The log statements(of hotfix-start) show that the hotfix branch was created out of master but not sure why this error pops up. Can you add

--allow-unrelated-histories

option to git merge statement where it tries to merge hotfix branch into master branch? The hotfix branch it tries to checkout does exists and is all good there.

Runner configuration: Java: 16.0.2 Maven: 3.8.2

plugin configurations used for reference:

[DEBUG] Configuring mojo 'com.amashchenko.maven.plugin:gitflow-maven-plugin:1.16.0:hotfix-finish' with basic configurator -->
[DEBUG]   (f) commitMessages = com.amashchenko.maven.plugin.gitflow.CommitMessages@41bf79da
[DEBUG]   (f) fetchRemote = true
[DEBUG]   (s) productionBranch = master
[DEBUG]   (s) developmentBranch = develop
[DEBUG]   (s) releaseBranchPrefix = release-
[DEBUG]   (s) hotfixBranchPrefix = hotfix-
[DEBUG]   (f) gitFlowConfig = com.amashchenko.maven.plugin.gitflow.GitFlowConfig@f3021cb
[DEBUG]   (f) gpgSignCommit = false
[DEBUG]   (f) gpgSignTag = false
[DEBUG]   (f) hotfixBranch = hotfix-0.1.1
[DEBUG]   (f) installProject = false
[DEBUG]   (f) keepBranch = false
[DEBUG]   (f) mavenSession = org.apache.maven.execution.MavenSession@4aaae508
[DEBUG]   (f) pushRemote = true
[DEBUG]   (f) settings = org.apache.maven.execution.SettingsAdapter@6009bea
[DEBUG]   (f) skipMergeDevBranch = false
[DEBUG]   (f) skipMergeProdBranch = false
[DEBUG]   (f) skipTag = false
[DEBUG]   (f) skipTestProject = false
[DEBUG]   (f) tychoBuild = false
[DEBUG]   (f) useSnapshotInHotfix = false
[DEBUG]   (f) verbose = false
[DEBUG]   (f) versionsForceUpdate = false
[DEBUG] -- end configuration --
aleksandr-m commented 2 years ago

Does it happen locally also? Which merge fails?

aleksandr-m commented 2 years ago

@vinukm Ping.