1

I use maven to create releases using gitflow-maven-plugin. My projects builds fine, unless I create a release calling the following maven command

mvn -B gitflow:release

This fails with the following error

[ERROR] Failed to execute goal com.amashchenko.maven.plugin:gitflow-maven-plugin:1.9.0:release (default-cli) on project test: 
release: Remote branch 'origin/master' is ahead of the local branch 'master'. 
Execute git pull. -> [Help 1]

There are no changes on the master so there should be no such error, especially also cause the plugin does a fetch beforehand as shown in the log

16:03:21 [INFO] Fetching remote branch 'origin master'.
16:03:21 [INFO] Comparing local branch 'master' with remote 'origin/master'

Any clue what could cause that?

papanito
  • 2,349
  • 2
  • 32
  • 60
  • Any updates on this issue? I ran into the same problem. After the first release I have to manually reset/push-force the master branch in order to work for the next release. – Thomas Dec 09 '18 at 22:40
  • Not at the moment, did not pursue the issue for now as we decided not to use gitflow for now – papanito Dec 10 '18 at 06:20
  • 2
    I found a workaround specific to building with Jenkins. I activated the option to delete the workspace at the end of the build. From that point on, it will actually correctly fetch master each time since all the local git files are wiped out each time. – Stefan Feb 28 '19 at 16:25

1 Answers1

0

When I downloaded the workspace zip archive to inspect the cause of this problem, git showed that that master branch was indeed behind the remote master.

In the Jenkinsfile I only did

git checkout develop && git pull --rebase

I fixed the problem by pulling the master branch, too

git checkout master && git pull --rebase
git checkout develop && git pull --rebase

Probably a git fetch also would have sufficed

lilalinux
  • 2,903
  • 3
  • 43
  • 53