Over the last few years, the changes to the commands available for git has exploded. I was looking at some of the new commands and one looked super awesome.
Switching branches has always been a little non-intuitive to me when using the git command line. You run the following command:
git checkout 'another_branch'
This has always weird because I was not checking out the other branch, I was just switching to a different branch that was already checked out.
When I was looking at the new commands, I found this:
git switch 'another_branch'
This seemed way more intuitive so I figured I should start using that instead of checkout. Well, it turns out that I needed to update my git client for windows to get that new command. This caused me to remember that upgrading git is a pain. Is it worth doing just for this one new command?
I was surprised to find out that upgrading git client for windows has changed as well and now it is super easy. All you need to do is run the command below.
git update-git-for-windows
I remember back in the day that you needed to download a new version of the client and install it by hand, but this command does everything for you. It turns out that they have made this process better over time. I have listed the upgrade paths for the different git version below.
You will find the steps below on how to upgrade you git for windows no matter what version you are running.
You will want to start by checking your git version by running
git version
Then based on your version you can do one of the steps below
If your version is 2.14.1 or earlier:
You will need to uninstall git for windows, download the latest version, and install again.
If your version is between 2.14.2 and 2.16.1:
git update
If your version is greater than 2.16.1:
git update-git-for-windows