Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Git Dev-to-Prod Deployment Workflow

git development -> production deployment workflow

Working with 2 separate repos to store your development and production code bases.

In your development repository directory:

Add a remote for the production repository:

git remote add production

Update remotes and fetch

git remote update

git fetch

create a new branch in your development repo called production from production/master remote

git checkout -b production production/master

You now have a few options.

Option 1: Pull all latest commits from development into production branch

git pull origin master

Option 2: Pick a single commit (result of a squash or bug fix) you would like to merge into production

git cherry-pick <SHA hash of commit>

If there are merge conflicts, do 2 things:

  1. fix any merge conflicts and commit
git commit -m "production release 1.0.4"
  1. retrieve production changes and replay your commits on top
git pull --rebase

push current branch head (non-master) to production master

git push production HEAD:master


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment