Summary
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.
Tutorials
Introduction
Why should I use Git?
Learn why you should use Git.
Setup
Install Git*
Learn how to install Git on macOS and Windows.
Set user name and email address
git config --global user.name "Your Name"
git config --global user.email youremail@example.com
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.
Notice any errors? Have other questions or suggestions? Send your comments and questions to contact@simpledev.io.