Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git philosophy: how to get "master" branch to "production" branch?

Pretty sure I'm misunderstanding git.

My goal

  • I have a private repo on github with a "master" branch.
  • I would like to also have a production branch, which I will push all my changes from master to.
  • I would then like to connect it to Azure and tell Azure to automatically deploy from the production branch.

Question

How do I best accomplish this? Initially I was thinking it was with "git push", but I believe that's for remote repositories, and so I'm now wondering what the best practice is to merge the "master" branch to the "production" branch.

Or, am I thinking about the whole thing wrong?

Thanks -- looking forward to putting my Subversion days behind me.

like image 684
SeanKilleen Avatar asked Nov 17 '12 16:11

SeanKilleen


People also ask

How do I merge master into main branch GitHub?

In GitHub Desktop, click Current Branch. Click Choose a branch to merge into BRANCH. Click the branch you want to merge into the current branch, then click Merge BRANCH into BRANCH.

How do I force merge a branch into master?

Simply log into the GitLab web app, choose the option to create a GitLab merge request, specify the master branch as the source and the protected branch as the target of the merge. The merge request can be used to have GitLab merge master in a branch that is protected.


1 Answers

(Since I am suppose to share a "wealth of information" ;) ...)

What you are looking at, when talking about master and production branches, is a merge workflow.

You can define the workflow you need with any Version Control System tool you want, and in term of development lifecycle management, one of the most complete set of merge workflow set is described in this TFS (Team Foundation Server) set, detailed in its TFS Brancing Guide and illustrated in this question "Servicing Branch in Standard Branch Plan".
Closer to git, git flow is another merging workflow quite popular.

But you are using a DVCS, and its distributed aspect introduces another (orthogonal) workflow: a publication one (your git push -u origin prod). See "Source Control - Distributed Systems vs. Non Distributed - What's the difference?"

Publication, part of release management, is quite different from merge, part of development.
By merging master to prod, you freeze what has been consolidating in development, and mark it as to be released.
By pushing it to GitHub, you start that release process.

like image 186
VonC Avatar answered Nov 11 '22 07:11

VonC