Skip to content

Hotfixing on Umbraco Cloud with Git

Today I needed to fix something on the production site though the development site wasn’t in a deployable state. What to do?

TL;DR: Go to the recap with the essential steps.


I’m pretty much using a standard setup when working with Umbraco Cloud these days:

I setup both a Development and a Live environment and when I clone the site, I specifically name the origin DEV instead of the default origin:

git clone --origin DEV <URL> "<ProjectName>.Web"

I also add a second remote pointing to the Live environment:

git remote add LIVE <URL>

This way I can see the environment’s name in the GitHub Desktop client and I (ideally) won’t accidentally push to the live environment 😱.

GitHub Desktop Client showing the remote's name as 'DEV'
The GitHub Desktop Client shows the remote's name on the 'Pull' button


So, back to my problem…

The Umbraco Documentation actually has some (very) detailed information about this, and a couple of examples of how to go about it. If you’re using GitKraken or a similar client, you may just have a look at those first. I happen to use the GitHub Desktop client and a fair share of command line git, so I went about my own way to solve this.

Separate commit(s)

First off, I fixed the actual problem on the local clone (DEV) to make sure I wouldn’t accidentally remove it again, whenever the in-development version eventually gets deployed to LIVE. I also make sure to make separate commits that can later be cherry-picked for inclusion on the LIVE site.

Using either GitHub Desktop or the command line, I grab the hash of the commit(s) I’ve just created.

Transfer to the LIVE remote

Next up, I’ll fetch the latest changes from Umbraco Cloud and create a new hotfix branch from LIVE’s master:

git fetch LIVE
git checkout LIVE/master # << You'll be notified about a detached HEAD - don't panic :)
git checkout -b hotfix

All set to add the changes to the hotfix branch now:

git cherry-pick <HASH>

Now comes the scary part – we want to push the hotfix branch directly into the LIVE remote’s master branch (!)

git push LIVE hotfix:master

And there we have it; a hotfix deployed to the LIVE site and we can continue work on DEV until we’re ready, and not worry about forgetting to get that hotfix in as well.


So, in short: