From 5ce081ba72ad2866ceb9215d4d3044bb9df41952 Mon Sep 17 00:00:00 2001 From: Alex Suraci Date: Wed, 12 Mar 2014 10:25:35 -0700 Subject: [PATCH] git deploy pushes to given branch (default master) Signed-off-by: David Varvel --- pkg/plugin/deploy/git.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pkg/plugin/deploy/git.go b/pkg/plugin/deploy/git.go index cc8a3e837..03df6f083 100644 --- a/pkg/plugin/deploy/git.go +++ b/pkg/plugin/deploy/git.go @@ -23,6 +23,11 @@ func (g *Git) Write(f *buildfile.Buildfile) { // add target as a git remote f.WriteCmd(fmt.Sprintf("git remote add deploy %s", g.Target)) + destinationBranch := g.Branch + if destinationBranch == "" { + destinationBranch = "master" + } + switch g.Force { case true: // this is useful when the there are artifacts generated @@ -30,9 +35,9 @@ func (g *Git) Write(f *buildfile.Buildfile) { // that need to be deployed to git remote. f.WriteCmd(fmt.Sprintf("git add -A")) f.WriteCmd(fmt.Sprintf("git commit -m 'add build artifacts'")) - f.WriteCmd(fmt.Sprintf("git push deploy $COMMIT:master --force")) + f.WriteCmd(fmt.Sprintf("git push deploy $COMMIT:%s --force", destinationBranch)) case false: // otherwise we just do a standard git push - f.WriteCmd(fmt.Sprintf("git push deploy $COMMIT:master")) + f.WriteCmd(fmt.Sprintf("git push deploy $COMMIT:%s", destinationBranch)) } }