Git for Windows
Introduction
I have a new computer. It runs Windows 10. It doesn’t have Git. I need Git to update this very website. That’s a problem.
Let’s remedy it.
Downloading the Installer
The installer for Git 2.26.0 can be found here. That was the latest version at the time of writing of this article.
The latest version of the installer can be found at the Git for Windows website here.
Installing Git for Windows
Start the installer and perform the following steps:
- The first thing that came up for me was a UAC dialog asking if I wanted the installer to make changes. I agreed.
- Agree to the license by clicking ‘Next’
- The default installation location is acceptable. Click ‘Next’
- I deselected the following components:
- Everything under Windows Explorer integration
- Associate .sh files to be run with Bash Then click ‘Next’.
- The default options are acceptable on the next screen. Click ‘Next’.
- I switched the default editor to Notepad++ and clicked ‘Next’
- I changed the PATH option to utilize Git and additional tools from the command line, then clicked ‘Next’.
- I left the OpenSSL option for the HTTPS Transport Back End and clicked ‘Next’.
- I left the line ending options intact and clicked ‘Next’
- I left the terminal options as-is and clicked ‘Next’
- I left the extra options at the defaults and clicked ‘Install’.
- The installation commences.
- When installation finishes, I de-selected ‘View Release Notes’ and clicked ‘Next->’, which, I guess should have been ‘Finish’.
Installation is done!
Installation Verification
To verify the install, do the following:
- Open a Command Prompt
- Type ‘git’ - the output should be similar to below:
Git Configuration
The following steps can be performed to configure Git with your name and email address:
- Open a command interpreter from which you can call git
- Provide Git your email and name with these command line:
git config –global user.email “hahaha.no@waywillItellthis.fin” git config –global user.name “Stephen Friederichs”
Git Commands
I just had an ‘Oh crap’ moment with Git that I was able to fix, so I decided I’d add some common commands that I use here.
Reverting Changes in a Working Copy
Alright, I’m sure someone is going to browbeat me about the fact that ‘revert’ and ‘working copy’ are Subversion concepts that Git doesn’t have. I will accept this punishment because I understand that I’m a dinosaur who can’t learn new things. I will have to subsist on likening my new knowledge to my old knowledge instead of actually learning new concepts.
So, in that spirit, let’s discuss ‘reverting’ ‘uncommitted’ changes in git. If you’ve done something foolish in Git but haven’t committed it yet, you can back out what you just did. With one simple command:
That command will unstage all uncommitted changes in the local filesystem.