Skip to content

To view all of the 300+ tutorials on Simple Dev, sign up for a 10-day free trial below.

Git Basics


Below you will find a collection of tutorials teaching the basics of Git, the version control system.

Before You Start

These tutorials assume you have a basic understanding of the terminal.


You can download exercises to go along with these tutorials on our Git exercises repository on GitHub. You don’t have to know how to use GitHub to use them. Just click the green Code button in the corner and click the Download ZIP option. Then unzip the folder and open it in your text editor.



Why should I use Git?

Learn why you should use Git.


Install Git

Learn how to install Git on Windows and macOS.

Set user name and email address

git config --global "Your Name"
git config --global

Initialize a repo

git init

Create .gitignore file

Learn how to create a .gitignore file.

Basic Workflow

Stage files

git add .

Commit files

git commit -m "Your commit message"

View previous commits

git log

Basic workflow

Learn a basic workflow you can use to practice using Git.

Intermediate Workflow

Create branch

git checkout -b branch-name

Switch branch

git checkout branch-name

Merge branches

git checkout branch-to-merge-into
git merge branch-with-changes

Delete branch

git branch -d branch-name

Intermediate workflow*

Learn an intermediate workflow you can use with Git.

Undoing Things

Undo git init

To undo the git init command, delete the .git folder.

Discard changes to file

git checkout -- file-name

Unstage files

git reset HEAD file-name

Edit your last commit

git commit --amend

Undo your last commit

git reset --soft HEAD~1

* work in progress

** coming soon

Next Steps

After learning Git, you can move on to our GitHub section, which will allow you to back up your local repositories to GitHub and collaborate with other developers.