Skip to content

Instantly share code, notes, and snippets.

@hmbrg
Last active April 24, 2016 15:30
Show Gist options
  • Select an option

  • Save hmbrg/a42965de54adb78c63cdeb6528efb489 to your computer and use it in GitHub Desktop.

Select an option

Save hmbrg/a42965de54adb78c63cdeb6528efb489 to your computer and use it in GitHub Desktop.
OpenShift: Git deployment process

OpenShift: Git deployment process

This document assumes that you already have an existing project git repo and now want to add OpenShift for deployment.

You should also have installed and setup the rhc tool by OpenShift and created an application on the OpenShift platform.

Setup

Add remote to OpenShift (only once)

Get ssh git adress from the OpenShift Dashboard/Application. Then add from root of repo folder a new remote to git repo.

git remote add openshift <openshift-git-repo-url>

Create new openshift branch (only once)

Create a new git branch for staging/preparing for deployment.

git checkout -b openshift

-b-option creates new branch and checksout/switches to it.

Routine

Add changes to openshift branch and deploy to OpenShift

We checkout to the openshift branch and merge/update it according to the master branch and then push it to the OpenShift platform.

git checkout openshift
git merge --no-ff master

You may now change stuff that needs to be changed for deployment and that commit it.

git push openshift HEAD:master -f

--no-ff ensures that we can see that the merge was done from and to this branch in visulization afterwards. -f forces all changes and avoids merge conflicts.

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