Git Basics
Note: Git is not Github, they are two different things.
Git is a distributed version control system, but Github is a web-based platform based on Git to host our codebase.
Introduction to Git
Git is a distributed version control system that allows you to track changes in our codebase. It is a powerful tool that can people to work together on the same codebase without stepping on each other’s toes.
There are three main areas where you will interact with Git:
Your local repository - This is where you will make changes to the codebase.
The staging area - This is where you will prepare your changes to be committed.
The remote repository - This is where the codebase is stored and where you will push your changes.
Sometimes you need to collaborate with others on the same codebase. In this case, we will introduce the concept of branches. A branch is a separate line of development that allows you to work on a feature without affecting the main codebase. Once you are done with your feature and reviewed by peer developers, you can merge your branch back into the main codebase. This is called a pull request (PR).
That’s it! You now have a basic understanding of Git and how to use it to work on a codebase.
Installing Git
To get started with Git, you will need to install Git on your machine.
- Windows users
You can download Git from the official Git website.
Run the installer and follow the instructions.
Once installed, you can open Git Bash to start using Git.
- You can verify that Git is installed by running:
git --version
- Mac users
Run the following command in your terminal:
xcode-select --install
xcode-select will prompt you to install the command line developer tools. Click “Install”.
- Command line developer tools include Git. You can verify this by running:
git --version
- Linux users
Run the following command in your terminal:
sudo apt-get install git
- You can verify that Git is installed by running:
git --version
Once you have Git installed, you need to configure your Git username and email. This is important because every Git commit will use this information to identify you as the author of the commit.
To configure your Git username and email, run the following commands:
git config --global user.name "Your Name"
git config --global user.email "
Now you are ready to start using Git!
Github Repository
We use Github to host our codebase. Github is a web-based platform that allows you to store and manage your codebase. It also provides tools for collaboration such as pull requests, issues, and project boards.
To connect your local repository to the remote repository on Github, you will need to create a Github account and get upload your public SSH key to Github.
To create a Github account, go to the Github website and follow the instructions to create an account.
SSH Key is a secure way to connect to Github without having to enter your username and password every time. To generate an SSH key, run the following command in your terminal:
ssh-keygen -t rsa -b 4096 -C "github-verify-ssh"
This command will generate an SSH key pair. You will be prompted to enter a passphrase. You can leave it blank if you don’t want to enter a passphrase.
Once the SSH key is generated, you can add it to your SSH agent by running:
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa
Now you can copy the public SSH key to your clipboard by running:
cat ~/.ssh/id_rsa.pub | pbcopy
Now you can add the SSH key to your Github account. Go to your Github account settings, click on “SSH and GPG keys”, and click on “New SSH key”. Paste the public SSH key into the text box and click “Add SSH key”.
Now you are ready to connect your local repository to the remote repository on Github.
Clone Onboarding Repository
Run the following command to clone the onboarding repository:
git clone https://github.com/waterloo-rocketry/software-onboarding.git
Read the README.md file in the repository to get started with the onboarding process.
Congratulations! You have enough knowledge to get started with Git and Github. To check out Git Commands, go to the next page.