Search code examples
gitopenshiftopenshift-client-tools

How to get an earlier commit to display on openshift?


So I have my local repository, and I have an earlier commit which I want to revert my production site to. I can check it out and make it a branch and push it to openshift. The branch then shows in openshift but when I try to checkout the branch in openshift, I get this error:

[appdev-deltaskelta.rhcloud.com appdev.git]\> git checkout old-state
fatal: This operation must be run in a work tree

So I can revert my local repo to the point that I want, but how can I get openshift to use the commit that I wnat to revert to. I hope I explained this well, I am not sure how else to say it.


Solution

  • There is a native solution builtin. With the rhc app-configure command, you can list the current branch which is used for deployment:

    rhc app-configure
    

    To change the branch to deploy from issue the following command:

    rhc app-configure --deployment-branch <your_branch>
    

    More details can be found at Introduction to Deployments and Rollbacks on OpenShift.