How to make git commands in a script task

I try to make a simple git merge command in an inline script task.

This script task is executed just after a source code checkout task (on master).

This is my script task :

git merge develop

This is the error:

fatal: develop - not something we can merge

The 2 branches can be merged so I don't understand why I have this error

1 answer

1 accepted

Accepted Answer
1 vote

the local repository for your plan is created via

git init

git fetch

You probably need to fetch the branch to your repo first. Try executing your script task command manually in the plan build directory.

BTW. Is the branch integration feature not enough for your use case?

Maybe the branch integration feature can help me but I don't know how.

I have multiple jobs

  1. Tests: checkout develop branch and run unit tests
  2. If first job is ok
    1. merge develop on master (I don't know how)
    2. If possible I would like to tag and push the tags on origin
    3. some others things via scripts
  3. If previous job is ok I have other jobs to deploy but I know how to do it

Do you know any good tutorial or example on how to achieve that ?

I already read bamboo documentation and it's not clear enough for me

Thank you in advance

Please check if enabling Gatekeeper mode on that branch works for you then. It will merge with master only if the build is succesful.

Tagging will still not work unless you explicitely hook up your git checkout to repository

When you say build you mean the whole plan ?

develop branch will be merged to master only if the whole plan is successful ?

Ok, i managed to merge my branch with the gatekeeper mode but it seems the merge appens at the end of the plan. Is it true ?

Is it possible to launch the merge after a job or a stage ?

Suggest an answer

Log in or Sign up to answer
Community showcase
Published yesterday in Jira Ops

Jira Ops Early Access Program Update #1: Announcing our next feature and a new integration

Thanks for signing up for Jira Ops! I’m Matt Ryall, leader for the Jira Ops product team at Atlassian. Since this is a brand new product, we’ll be delivering improvements quickly and sharing updates...

289 views 0 6
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you