01-05-2021



In this article you'll find a step-by-step guide on how to apply a hotfix to a Live environment by using only Git.

When comparing Visual Studio vs GitKraken, the Slant community recommends GitKraken for most people. In the question “What are the best Git clients for Windows?” GitKraken is ranked 2nd while Visual Studio is ranked 16th. The most important reason people chose GitKraken is. GitKraken allows you to connect to Azure DevOps (formerly VSTS), which will help you find repos on Azure DevOps when cloning. Visual Studio Code is ranked 3rd while GitKraken is ranked 4th. The most important reason people chose Visual Studio Code is: There is very solid TypeScript integration in Visual Studio Code. Both are developed by Microsoft and VSC itself is written in TypeScript. GitKraken Integration. Only a standalone version of Code Compare can be integrated into GitKraken. In the Visual Studio extension, unfortunately, there is no possibility of integrating with GitKraken. This is due to the fact that GitKraken has some access restrictions to its files, therefore, documents cannot be opened in Visual Studio.

Tools used:

  • GitKraken

You can use whichever Git client or cli 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.

The scenario

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.

Apply selected changes to the Live environment

Here are the steps to follow in order to apply selected changes to the Live environment without deploying from Development to Live.

Gitkraken vs visual studio code

Branching and Cherry picking

  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).
  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 commits as you like.

  7. Your Git history will now look something like this.

Push to Live

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.

  2. In GitKraken add a new remote, by clicking the + next to 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.

  4. You will be prompted to authenticate - use your Umbraco Cloud credentials.

  5. Now 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.

  8. Hit Submit and the push will start.

  9. Note that 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.

  10. Find a guide on how to extract the files, in the Manual Extraction article.

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 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 building on your Development environment, follow the normal workflow of Cloud to deploy the changes to the Live environment.

Important notes

  • 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.

Update 2020-09-09

1. Fork

  • Has the most features.
  • Automatic and non-intrusive updates.
  • Experienced zero bugs so far.
Gitkraken

2. Sourcetree

  • Similar to Fork but less features.
  • Bugs on every PC i've installed it on.
  • No automatic updates.

Gitkraken Visual Studio

3. GitKraken

Gitkraken Visual Studio Plugin

  • Lacking in features and feels too primitive with the free version.

4. Visual Studio Team Explorer

This is a GIT GUI feature in the IDE Visual Studio.

  • It would be better than GitKraken if it allowed selecting of specific lines to be discarded. Lacking this feature makes it worse.

5. Github Desktop

  • Impossible to use this at work. Lacking too many features.