Apply hotfix by using Git
In this article, you'll find a step-by-step guide on how to apply a hotfix to a Live environment using only Git.
You can use whichever Git client or command line interface you prefer.
If you've never worked with cherry-picking before, we recommend that you use a Git client with a UI that gives you a visual overview of your commits.
You have an Umbraco Cloud project with two environments, Development and Live.
You have been working on building the site on a local clone of the Development environment, and now you want to send some but not all changes to the Live environment.
A set of commits have been pushed from your local clone to the Development environment. Out of these commits, you only need the changes from two of the commits in the Live environment for now.
Here are the steps to follow to apply selected changes to the Live environment without deploying from Development to Live.
- 1.Open your local clone of the Development repository in GitKraken (or your preferred Git client).
- 2.Make sure that the changes you push directly to your Live environment are already pushed to the Development environment. This will ensure that your environments are kept in sync.
- 3.Choose the commit where you want to create a new branch.
- This branch should be created in an earlier commit that is corresponding to the state of the Live environment (before the changes you've made locally have been committed).Creating new branch
- 4.With the new Hotfix branch checked out, it's now time to cherry-pick the commits you want to apply to the Live environment.
- 5.Right-click the commit you want and choose "Cherrypick commit".
- You will be asked if you want to commit this directly to the new branch - Choose Yes.
- Choose No if you want to create a new message for the commit.
- 6.You can cherrypick as many commit as you like.
- 7.Your Git history will now look something like this.Cherrypicking
Before you push the newly created branch to Umbraco Cloud we need to change the remote destination. If you hit Push now, the branch would be pushed to the Development environment. You need to add the Live environment as a new remote.
- 1.Find the clone URL for the Live environment in the Umbraco Cloud Portal.Live Clone URL
- 2.In GitKraken add a new remote, by clicking the + next to Remote.Add new remote
- 3.Give the new remote a name - like Live, and add the clone URL for the Live environment to both Push URL and Pull URL - click Add Remote.Add Live as remote
- 4.You will be prompted to authenticate - use your Umbraco Cloud credentials.
- 5.You will see that the history from the Live repository is visible in the Git history.
- 6.Next step; hit Push.
- 7.Choose to push to the newly added remote, and write master to make sure you are pushing to the master branch on the Live environment.Choose remote
- 8.Hit Submit and the push will start.
When changes are pushed directly to a Live environment and you have more than one environment, the changes are not automatically extracted into the site.
You have now applied a hotfix to the Live environment. Make sure that you merge and remove the branch you've created on the Development repository before pushing it to the Development environment on Cloud. You can always create a new branch if you need to apply another hotfix to the Live environment.
When you are ready to build on your Development environment, follow the normal workflow of the Cloud to deploy the changes to the Live environment.
- This guide can also be used for applying a hotfix to a Staging environment.
- The above describes the workflow in GitKraken. You can use a git client of your choice or Git terminal/command prompt if you are comfortable with that.
Last modified 8d ago