Visit your repository on the web and select the Clone button in the upper right. Select SSH and copy the new SSH URL. In your Git client, run: git remote set-url. Alternatively, in Visual Studio, go to Repository Settings, and edit your remotes. Lacking in features and feels too primitive with the free version. 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. Impossible to use this at work.
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.
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.
Gitkraken Visual Studio Plugin
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.
Branching and Cherry picking
Open your local clone of the Development repository in GitKraken (or your preferred Git client).
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.
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).
With the new Hotfix branch checked out, it's now time to cherry pick the commits you want to apply to the Live environment.
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.
You can cherrypick as many commits as you like.
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.
Find the clone URL for the Live environment in the Umbraco Cloud Portal.
In GitKraken add a new remote, by clicking the + next to Remote.
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.
You will be prompted to authenticate - use your Umbraco Cloud credentials.
Now you will see that the history from the Live repository is visible in the Git history.
Next step; hit Push.
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.
Hit Submit and the push will start.
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.
Find a guide on how to extract the files, in the Manual Extraction article.
You have now applied a hotfix to the Live environment.
Gitkraken Visual Studio 2019
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.
Gitkraken Visual Studio Code
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.