This document describes how to get up and running with the Git version control system. It is intended to support my students at Vermont State University and does not cover all (or even most) aspects of Git.
I recommend installing Git via Scoop. Scoop is a package manager that allows you to install Git and other software easily. While it is overkill for just Git, you will likely find it useful for installing a rich collection of development tools. Note that Scoop keeps everything it installs in your profile; you do not need to be Administrator to install it or any of the packages it provides.
Scoop is neither a virtualization system nor a Linux-like environment. Scoop, and the packages it provides, are all native Windows executables.
Follow the instructions on the Scoop website to install the base tool. Then, open a new PowerShell terminal and use the command scoop install git to install Git. Scoop relies on Git for some of its functionality, so you will need to do this anyway if you want to use Scoop in a useful way.
As an example of what Scoop can do, here is the command that installs less, the file viewing tool that is commonly used on Linux (this tool is not necessary to use Git):
C:\> scoop install less
You can use scoop search to list available packages. To see packages you have installed, use scoop list. To update all installed packages to their latest versions, use scoop update *.
I recommend installing Git on macOS using Homebrew. Homebrew is a package manager for macOS that makes it easy to install and manage software, including many development tools.
Follow the instructions on the Homebrew website to install the base tool. Then, open a new terminal and use the command brew install git to install Git.
As an example of what Homebrew can do, here is the command that installs Neovim, a modernized version of the Vim editor (this tool is not necessary to use Git):
$ brew install neovim
To see the packages you have installed, use brew list. To update all installed packages to their latest versions, use brew upgrade.
TODO: Finish me!
If you plan to make any commits (and you probably do) you should configure Git with information about your identity. At the prompt (Windows users open the Git bash shell) issue the following commands:
$ git config --global user.name "Jill Jones" $ git config --global user.email jjones@vermontstate.edu
These commands store your username and email address into your personal .gitconfig file (in your home directory on macOS/Linux or in your profile folder on Windows). These "global" settings apply to all your Git projects unless you override them with repository-specific settings later. Be sure to type "user.name" and "user.email" literally. They are configuration keywords, not something you should fill in. However, provide your real name and address at the end of each command.
You are now ready to use Git. But what is Git, exactly? Git is a distributed version control system. Let's briefly review what that means.
A version control system tracks previous versions of your files and helps coordinate changes made by multiple developers on the same set of files. Every version control system makes use of two main parts. The first is a repository that stores all versions of all files along with historical information about them (when changes were made, what was changed, who did the change, etc.). The second is a working copy that contains a view of a particular version of the repository.
Version control systems allow you to create branches of development where you can make changes to files in an exploratory way without disrupting the main line of work. Thus, a working copy is a particular version (usually the most recent version... referred to as the "head revision") of some branch. In Git terminology the main line of work is called the "main" branch, although older repositories often call it the "master" branch.
With a centralized version control system, the repository is kept on a server and each user checks out his or her working copy from that server. When a user makes a change, the modified files need to be "committed" to the server so that other developers can see them. This is a fine system and works very well for some projects.
With a distributed version control system like Git, every developer has a complete and independent copy of the entire repository. This allows developers to commit changes without being online and also brings some other benefits, as we will see. However, developers still need to periodically synchronize their work with each other, usually by "pushing" changes to and "pulling" changes from a special repository that serves as a central location for the project's code.
Before you can do anything interesting with Git, you will need a repository along with a working copy from that repository. It is natural to clone an existing repository for this purpose. For example, you can clone my Hexdump project on GitHub by issuing the command:
$ git clone https://github.com/pchapin/hexdump.git Hexdump
This creates a folder named Hexdump (the last word on the command line) immediately below the working folder where the command is issued. Inside the Hexdump folder is a copy of the repository in the .git hidden subfolder and a checked-out working copy of the head revision of the main branch.
Generally, you ignore the repository inside .git and use git commands to manipulate it. However, the files in the working copy are ordinary files that you can read like any other. Typically, you would build the project right in the working copy; don't bother making a copy of the working copy!
When you want to get changes that others have pushed, issue the command:
$ git pull
from inside the Hexdump folder. This will download changes from the central repository on GitHub and immediately check them out to your working copy, modifying the files in your working copy as appropriate.
The command:
$ git status
gives you a short report of the status of your repository and working copy. You can use it to see if there are any modified files that have not yet been committed (for example, if you changed some files, perhaps without meaning to do so). In that case you can commit the modified files or revert them to their original state using a suitable Git command.
If you are contributing to the project, you are making modifications on purpose and then committing them to your local repository. At some suitable time, you could then push those changes back to the central repository on GitHub.
Even if you aren't contributing to the project in general, you may wish to modify files in your working copy for your own purposes, such as for your homework assignments. To do that, I recommend you create one or more branches, as I describe in the next section.
One of the strengths of distributed version control systems is their support for "lightweight branching." It is a simple matter to create multiple branches of development and then later delete them if the work doesn't play out. As an example, using Git, suppose you wanted to create a branch for homework assignment #1. You could proceed as follows:
$ git branch
This command shows you all the branches in your repository. At first, this will likely only show you the "main" branch. The branch that you have checked out in your working copy is highlighted with a '*' character. I often use the git branch command, along with the git status command to just review my current situation.
To create a new branch for homework #1, do something like:
$ git branch hw01
You can use the git branch command again to verify that the branch was created. Notice, however, that it is not selected; the current branch in your working copy is still the main branch (as indicated by the '*' character).
To switch to the new branch, do:
$ git checkout hw01
This rearranges your working copy to match the head revision of the new branch. Since the branch is identical to the main branch when you created it, nothing is actually done this time. However it is now appropriate for you to make changes according to your assignment.
If you need to add a new file, use the command:
$ git add newfile.c
If you need to remove an existing file, use the command:
$ git rm oldfile.c
You can't just delete a file in the usual way; Git won't know about the removal and will complain that the file is missing (you can restore it from the repository if you delete it accidentally).
When you've reached a natural stopping point for your work, you should commit it using a command such as:
$ git commit -a -m "Log message"
The -a option adds all modified files (you usually want that), and the -m option introduces the log message. You should provide a good log message that describes the purpose of your change. The log messages become part of the repository history and can be viewed later if you want to find a change you made in the past.
I recommend using the git status command just before doing a commit to review which files you've modified and to see if there are any new files that you haven't yet added. The -a option only "adds" modifies files already known to Git. You need to explicitly git add any brand-new files.
Often there are files that you don't want to add to the repository. Any files that are generated by your project's build process can be generated by others on demand and don't need to be stored in version control. This includes, fore example, PDFs that were exported from Word documents. In that case, the Word document is the source file, and the PDF is a generated file. Only commit artifacts of your development process.
To manage files that need to be ignored, Git allows reads a special file called .gitignore that contains patterns for files that should be ignored. It is a plain text file that you can edit and adapt to your needs. It should be committed to the repository so that other developers will also ignore those files.
When creating log messages, it is helpful to use the phrase, "If applied, this commit will <insert description of change here>." For example, "If applied, this commit will add more input validation." means you should use "Add more input validation." as your log message. Log messages should be in the present tense and imperative. Avoid writing log messages in the past tense. Log messages should be descriptive so they can be searched for in a useful way.
Also, log messages should also be concise. Keep them limited to one short-ish sentence. Git provides a way to attach a "description" to a commit where you can provide more details about a change when appropriate. Avoid stuffing too much information into the log message.
You can make as many commits as you like to your own repository. If you want to return to the main branch, perhaps to review something, do:
$ git checkout main
This will reorganize your working copy to match the main branch. Your changes will vanish... but they won't be lost. You can go back to your work by just doing:
$ git checkout hw01
You can even make multiple branches for different purposes but be aware that when you create a branch, it will initially be a duplicate of whatever branch you currently have checked out. For example, when you create a branch for homework assignment #2 you should probably first check out the main branch to use as a base for the hw02 branch.
Finally, keep in mind that if you have uncommitted changes when you switch to a new branch, those changes will be carried over to the new branch. In most cases you will want to commit all your changes before switching branches.
Last Revised: 2026-11-18
© Copyright 2026 by Peter Chapin
<peter.chapin@vermontstate.edu>