Usually, you can grab the latest Git release from the official website and install it on Windows the traditional way.
But in this post, I’ll show you how to update Git for Windows directly from the command line, quick and hassle-free.
Let’s get started 🤓
▶️Prefer a video instead? I got you covered:
Check Git Version
First, you should check which Git version you’re running:
git version
# Output
# git version 2.48.1.windows.1Ideally, you would also like to check what the latest Git version is. Unfortunately, Git doesn’t have a built-in command for that. But we can use curl to check the latest release directly form GitHub:
curl -s https://api.github.com/repos/git-for-windows/git/releases/latest | grep tag_name
# Output
# "tag_name": "v2.51.2.windows.1",If you plan to use this command again in the future, I’d say it’s a good idea to create an alias to save time.
Update Git for Windows
Depending on your current version, the command differs slightly.
If your Git version is between 2.14.2 and 2.16.1, run:
git updateBut if you’re on 2.16.1 or newer, use:
git update-git-for-windowsOr, if you want to YOLO SWAG IT, just run git update and Git will give you a warning showing the new version available and also asking if you want to install it:
git update
# Output
# Warning! `git update` has been deprecated;
# Please use `git update-git-for-windows` instead.
# Git for Windows 2.48.1.windows.1 (64-bit)
# Update 2.51.1.windows.1 is available
# Download and install Git for Windows 2.51.1.windows.1 [N/y]?But be careful, in the future, this warning will most likely disappear, so I recommend using the correct command.
That’s it! Happy building 💜
Let me know what you think about this article in the comments section below.
If you find this article helpful, please share it with others and subscribe to the blog to support me, and receive a bi-monthly-ish e-mail notification on my latest articles.