Skip to content
  • iImagine
  • Register
  • Log In

Web Development School

Learning made easy.

  • Books
    • Beginning Web Development with ASP.Net Core & Client-Side Technologies
      • TOC
      • Part 1
        • Chapter 1: Static HTML – Designing the landing page
      • Part 2
        • Chapter 2: ASP.Net Core – Let’s talk Dynamic
        • Chapter 3: Introduction to ASP.Net Core MVC
          [ASP.Net Core v9]
      • Part 4
        • Chapter 7: Using Server Side & Client Side technologies together
          [ASP.Net Core v7 & Angular 15]
  • Environment Setup
    • Installing Angular
    • Installing Visual Studio 2022
    • Installing SQL Server 2022 Express
    • Installing Postman
    • Installing Git for Windows
  • Blog
  • iImagine WebSolutions
  • Events
  • Learning Videos
  • Toggle search form

Installing Git for Windows

Posted on October 20, 2023February 10, 2024 By Scott No Comments on Installing Git for Windows
Table Of Contents
  1. Download Git for Windows
  2. Install Git
  3. Exploring Git for Windows after the Install
    • Git from the command line
    • Git from PowerShell
    • Git from Git Bash
    • Git from Windows Explorer
      • Git Bash
      • Git GUI
  4. A few simple Git commands
    • Initialize a folder
    • Check a folders status
    • Create a file for Git to track
  5. Stage a file to be tracked
  6. Commit a change
    • git commit options
  7. Modify a Text file's contents for Git to track
  8. GitHub Desktop
    • Download and Install GitHub Desktop

Git is one of the most popular source control tools or SCM (Source Control Management) tools out there. If you need to track changes to your code, you’ll probably want to download and install this tool. This article serves as a quick cheat sheet to get Git setup on your computer and start getting familiar with the most used commands.

Installing git for windows will give you the following features:

  • Git Bash
    • an emulator used to run Git from the command line.
  • Git Gui
    • user interface for most Git commands.
    • visual diff tools
  • Shell integration
    • right click on any folder in Windows Explorer to access the BASH or GUI.

Download Git for Windows

Go to git for windows to download the install and click the Download button.

Install Git

Go to your downloads folder by clicking the downloads icon in the toolbar at the top of your browser.

Right click on the executable in your downloads folder and select Run as administrator.

When asked if you would like this application to make changes, click the Yes button in the User Control Panel.

Next, the Git installation package will start up. Click the Next button to accept the License agreement.

On the “Select Destination Location” screen, accept the default location by clicking the Next button.

On the “Select Components” screen, just select all of the components and click the Next button to continue.

On the “Select Start Menu Folder”, leave the defaults and click Next to continue.

On the “Choosing the default editor used by Git” screen, choose the preferred editor you want to work with Git in. I chose “Select other editor as Git’s default editor” from the drop down so I could set the location to my favorite editor, TextPad.

If you want to install TextPad on your computer so you can set that as your favorite editor you can download the install executable here: https://textpad.com/download.

Click Next to continue.


In recent years, the developer community has started to use the term, “main”, rather than, “master”, as the primary branch of a repository. The next screen gives you the option to choose between the two.


On the “Adjusting the name of the initial branch in new repositories” screen, choose “Override the default branch name for new repositories” and leave the default name of “main”. Click Next to continue.

On the “Adjusting your PATH environment screen”, Select “Git from the command line and also from 3rd-party software”, so we can use Git commands from a command line and also PowerShell as well as from Git Bash.

On the “Choosing the SSH executable” screen, leave the default and click Next to continue.

On the “Choosing HTTPS transport backend”, leave the default and click Next.

On the “Configuring the line ending conversions” screen, leave the default and click Next to continue.

On the “Configuring the terminal emulator to use with Git Bash” screen, leave the default and click Next to continue.

On the “Choose the default behavior of ‘git pull'” screen, leave the default and click Next to continue.

On the “Choose a credential helper” screen, leave the default and select Next to continue.

On the “Configuring extra options” screen, leave the defaults and select Next to continue.

On the “Configuring experimental options” screen, leave both options unchecked and select Install.

Once the “Completing the Git Setup Wizard” screen appears, uncheck “View Release Notes” and click the Finish button.

Exploring Git for Windows after the Install

Once the install finishes, we can access Git from a few different options.

Git from the command line

To insert commands at the command line, search for cmd in the Windows Start menu.

In the results above, the best match is the Command Prompt App. But, you could also select the Developer Command Prompt for Visual Studio 2022.

If you don’t see the Visual Studio Command Prompt, you can install Visual Studio using my “Installing Visual Studio 2022” blog page.

At any rate, choose one of the command prompts to open and enter the following command to test that Git was installed properly.

git --version

In the results shown in the screen shot above, you can see I have installed Git version 2.42.0.windows.2.

Git from PowerShell

I like using Developer PowerShell for VS 2022 when I am working with Visual Studio Projects.

Again, if you haven’t installed Visual Studio, see Installing Visual Studio 2022.

You can get to the Developer PowerShell for VS 2022 from the Windows Start Menu in the Visual Studio 2022 group.

Git version command at VS 2022 PowerShell Command Prompt.

Git from Git Bash

We can get to Git Bash from the icon installed on the desktop or from the Windows Start Menu. (We can also access Git Bash from Windows Explorer which we will see in the next section.

Checking Git version in Git Bash

Git from Windows Explorer

Git Bash

You can also right click on a folder in Windows Explorer and select Git Bash here to open the Git Bash emulator with the command prompt targeting the selected folder.

Git GUI

If you prefer to work with a GUI (Graphical User Interface) rather then a command prompt, you can use the Git GUI. To start Git GUI, right click on a folder in Windows Explorer and select and select Open Git GUI here.

A few simple Git commands

In the Install Git section above, we saw that you can configure Git in the “Adjusting the name of the initial branch in new repositories” screen to use a default name like ‘main’ or any name you choose to type in for the primary branch of new repositories rather then ‘master’.

If you missed that setting or want to change the default name you typed in during the install, you can run the following command.

git config --global init.defaultBranch main

Initialize a folder

git init

In the screenshot above, I’ve entered two Git commands to change the default repository branch name to ‘main’ and to initialize the current directory: C:\Development\GetPractice. Git responds with a message indicating it has initialized an empty Git repository for that folder.

Check a folders status

Use the git status command to check the status of a folder.

git status

Create a file for Git to track

echo "practicing git" > file.txt
ls

In the above code we use the echo terminal command to create a file called “file.txt” and fill it with the text “practicing git”. Then we use the ls command to list the contents of the current directory.

Let’s run a git status command again to see where we are shall we?

git status

In the results above, the git status command is telling us that in our main branch we have no commits yet. We have one file called file.txt which we created earlier with the echo command, but we have not added it to be tracked yet. Notice file.txt is in red text under a section called “Untracked files”. In the next section we will add file.txt to be tracked with the git add command.

Stage a file to be tracked

So far we have created file.txt but it is not being tracked. We will change that now using the git add command.

git add file.txt

In the screen shot above after running the git add command we run another git status command to check the results. The results of the git status command at this point tell us that in our main branch we still have no commits, but we have added the fact that we created a new file called file.txt to Git’s recorded changes for this folder. Notice file.txt is now in green text under the section “Changes to be committed”. And the change is that file.txt is a new file.

This process is called, “Staging a file”, or “Staging a change”.

Commit a change

Now that we have a staged change, we need to commit it to the repository. We will do that next with the git commit command.

git commit -m "Adding file.txt"

In the screen shot above, we used the git commit command to commit all of the staged changes with the -m parameter to add a message to this commit.

If we once again run a git status command we will see the message, “nothing to commit, working tree clean.

git status

At this point we have created a repository on our local machine for a specific folder using the git init command, created a text file with some text in that folder, staged the change with git add, and committed the staged changes to the local repository with git commit.

So far we have been working with a local repository. Eventually we would “push” the local repository to a repository hub like GitHub.

git commit options

git commit

Commit the staged snapshot. This will launch a text editor prompting you for a commit message. After you’ve entered a message, save the file and close the editor to create the actual commit.

git commit -a

Commit a snapshot of all changes in the working directory. This only includes modifications to tracked files (those that have been added with git add at some point in their history).

git commit -m "commit message"

A shortcut command that immediately creates a commit with a passed commit message. By default, git commit will open up the locally configured text editor, and prompt for a commit message to be entered. Passing the -m option will forgo the text editor prompt in-favor of an inline message.

git commit -am "commit message"

A power user shortcut command that combines the -a and -m options. This combination immediately creates a commit of all the staged changes and takes an inline commit message.

git commit --amend

This option adds another level of functionality to the commit command. Passing this option will modify the last commit. Instead of creating a new commit, staged changes will be added to the previous commit. This command will open up the system’s configured text editor and prompt to change the previously specified commit message.

Modify a Text file’s contents for Git to track

Open file.txt, change the contents, save and close the file.

Run git status.

git status

This time in the results above, we are told that file.txt has been modified in red text and we are directed to once again use the git add command to stage the change.

Now run the following commands to stage the change, commit the change, and check the status.

git add file.txt
git commit -m "One modification to file.txt"
git status

GitHub Desktop

GitHub Desktop is a tool that makes it easier to manage repositories and GitHub connections from your local computer.

Download and Install GitHub Desktop

Go to https://desktop.github.com and click the “Download for Windows (64bit) button.

Once the download finishes, run the executable called GitHubDesktopSetup-x64.exe from you downloads folder.

A message will appear saying that GitHub Desktop is being installed.

Next you’ll be taken to the GitHub Desktop Welcome screen.

(At this point if you do not have a GitHub account you should go to github.com account now and create one before proceeding further.)

On the welcome screen, click the “Sign in to GitHub.com button.

Next, you’ll be taken to the “Authorize GitHub Desktop” screen in you’re browser. Click the “Authorize desktop” button.

When asked for your password type it in and click “Confirm”.

In your browser click the “Open GitHubDesktop.exe” button.

Next you’ll be taken to the “Configure Git” screen in the GitHub Desktop application. Click the finish button.

Related

Environment Setup

Post navigation

Previous Post: Installing Postman
Next Post: Angular Commands Cheat Sheet

More Related Articles

Installing Postman Environment Setup
Installing Visual Studio 2022 Environment Setup
Installing SQL Server 2022 Express Environment Setup
Installing Angular Angular

Leave a ReplyCancel reply

Chapter 1: Static HTML – Designing the landing page.

  • Static HTML – Designing the landing page.
  • Let’s get started!
  • Mock your site with HTML
  • Make CSS easy with Bootstrap
  • Mock your content
  • Introducing JavaScript
  • JavaScript Code Improvements
  • Results Data
  • Images and the HTML Image Element.
  • Revisiting Reusability for CSS and JavaScript
  • Reuse for HTML: PART 1
  • Reuse for HTML: PART 2
  • Details Page – Using a Bootstrap Component
  • Creating Links
  • Chapter One Conclusion

Chapter 2: ASP.Net Core – Let’s talk Dynamic

  • Introduction to ASP.Net Core
  • What is .Net?
  • What is ASP.Net
  • Introduction to Entity Framework Core

Chapter 3: ASP.Net MVC Core – Models, Views, and Controllers [ASP.Net Core v9]

  • Introduction to ASP.Net Core MVC
  • Create the project: ASP.Net Core MVC
  • Explore the ASP.Net Core Empty Web Project Template
  • Configure the Application for MVC
  • Create a Controller: Home Controller
  • Create a View: Index View for the Home Controller
  • Install Bootstrap using Libman
  • Create the Layout template
  • Create the Model
  • Install EF Core & Create the Database
  • Seed the Database: Loading test data
  • DI (Dependency Injection): Display a List of Vehicles
  • Repository Pattern: The Vehicles Repo
  • Unit Test 1: Home Controller Can Use Vehicle Repository
  • Unit Test 2: Vehicle Repository Can Return List
  • Add the ImagePath Migration and Thumbnail images to results
  • Pagination: Create a Custom Tag Helper
  • Sorting
  • Category Filter
  • Partial View: Break out the vehicle results
  • View Component: Create dynamic category buttons

Chapter 7: Using Server Side & Client Side technologies together. [ASP.Net Core v7 & Angular v15]

  • Intro to Full Stack Development
  • Fred’s Cars – Full Stack Development
  • Prepare the environment
  • Create the Visual Studio Solution
  • Add the ASP.Net Core Web API project
  • Add the Angular Project
  • Wire it up!
  • WeatherForecast: Understanding the basics
  • Vehicles API Controller: Mock Data
  • Vehicles Angular Component: Consuming Data
  • Routing and Navigation
  • Using a Component Library: Angular Material
  • Our first Angular Material Component: MatToolbar
  • Configuring for Saas: CSS with superpowers
  • Create the Header & Footer components
  • Displaying Results with MatTable
  • Loading: Using a Progress Spinner
  • MatTable: Client-Side Paging and Sorting
  • MatSidenav: Create a Search Sidebar
  • MatCheckbox: Category Search UI
  • Adding an image to the welcome page
  • Create the database with Entity Framework Core migrations
  • MatPaginator & PageEvent: Custom Server-Side Paging
  • Unit Testing: Custom Server-Side Paging
  • Repository Pattern: VehicleRepository
  • Unit Test: Paging in the Vehicles controller
  • Server-Side Sorting
  • Unit Tests: Sorting
  • Filter (Quick Search)
  • Unit Tests: Filter feature
  • Advanced Search: Categories
  • Unit Tests: Search by category
  • Progress Spinner: Final Fix

TOC

  • What were WebForms?
  • Enter MVC
    • Understanding MVC
    • Advantages of MVC
  • ASP.Net Core MVC – A total rewrite
  • ASP.Net Core 2 MVC – Here come Razor Pages
    • Understanding Razor Pages
  • ASP.Net Core 3 – Dropping the MVC reference
    • Understanding Blazor
  • Dropping the MVC reference
  • Hello .Net 5!
  • What’s Next? – Here comes .Net 6.

Recent Posts

  • Angular Commands Cheat Sheet
  • Installing Git for Windows
  • Installing Postman
  • Installing SQL Server 2022 Express
  • Installing Visual Studio 2022

Recent Comments

No comments to show.

Archives

  • November 2023
  • October 2023
  • June 2023
  • October 2021

Categories

  • Angular
  • ASP.Net
  • Environment Setup
  • See All
  • SQL Server
  • Visual Studio
  • Web API & Rest Services

WordPress Theme Editor

Copyright © 2025 Web Development School.

Powered by PressBook Blog WordPress theme