Using TC to automate git merge

I'm new to teamcity and git. I've been tasked wth trying to automate the merge process that the developers use for master and release branches.

I'm just looking to get pointed in the right direction. Most of the documentation I've seen on the web has been about automatic builds after a pull.

What I'l looking to do is push the run building and essentially the following git commands get executed.

The only solution I see currently is using teamcity and calling git from the command line. Wondering if there is a better "teamcity" way to perform the steps below.

# make sure release is up to date with master
git checkout master
git pull
git checkout release
git pull
git merge --no-ff master
git push origin release

# merge release into master
git checkout master
git merge --no-ff release
git push origin master

# merge master into develop
git checkout develop
git pull
git merge --no-ff master
git push origin develop

# merge develop into release (release is now the upcoming week)
git checkout release
git merge --no-ff develop
git push origin release

Please sign in to leave a comment.