Environment:Ubuntu 10.04 amd64
The Git SCM plugin has suffered from this problem since I started using it. Rather than merge the changes to be built into a branch which tracks the remote I want to push to, it checks out one rev and merges the others on, resulting in a detached HEAD. My build expects to be run on a specific branch, and it fails because the repo isn't in that state.
Other people have encountered the same problem, and there doesn't seem to be any solution other than to fix things in the build steps, which is a big hassle.
Can we please get this issue resolved, or if it's been fixed, clear instructions on how to make it work?
I've attached the SCM portion of my job's config.xml. What I'm trying to do is build changes committed to branches in the origin repo (SG), merge those into SG-gold/master and push them back to SG-gold/master.
Here are the commands where things seem to go wrong:
Rather than "git checkout gold/master", it finds the hash of gold/master and checks out that instead. This is the root of the problem.
In order to fix this, you have to put these in the first build step:
This is error-prone and requires duplication of the merge target branch that's already in the Git configuration for the job.