Skip to content
Adriana Massie edited this page Jul 4, 2020 · 7 revisions

Git is more than just a tool for keeping track of a history, it is mainly a tool for working together. Git allows teams to work in parallel on projects related to each other, and merge these sub-projects together into larger projects.

Git

How git works

Git is a distributed version control tool, developed for the development of the linux kernel -- the underlying software of all Linux operating systems.

There are two types of git repositories; ones with a workspace, and ones without. Every git repository contains a .git folder that has a complete record of all commits in the repository. This means that there is no central server. At first this may seem like this will cause problems with syncing, but that is not an issue, and the distributed model has many other benefits. To learn more, there is an online git tutorial with visualization to learn basic and advanced git usage.

Bare git repositories

A bare git repository is one without a workspace. These are typically remote repositories -- repositories that are mainly used for syncing other git repositories.

Examples include:

We currently use this website,github.com, as one of our remote repositories.

Github

What is Github?

Github is the current platform that you are currently on now. Github is a code hosting platform that uses git. It that lets you work with others on a project. Github also lets you store and organize code by having the option to create different versions of code, writing change messages and more.

Basic Commands

Github has different commands that allow you to make changes,and combine or create new copies of code.

  • Push: The push command sends out changes if your code to the repository and syncs your commits to the could.
  • Pull: The pull command takes changes that were made and merges them with the current code. This is how one will get updated code if the code has changes that were made by others.
  • Commit: A commit is a change to file(s). It's like when you save a file but when you save, git creates an ID that allows users to keep a record of what changes were made and who made the changes
  • Merge: A merge is when you take edits in a branch and put them in another branch that is in the same repository.

Basic terms

There are three main concepts that are commonly used when using Github. They are:

  • Repository A repository, or sometimes referred to as a “repo”, is a place where you keep the team’s code. It also has the history of changes that were made in the code. The repository can be connected to a folder or file on a computer or it can be directly online on Github.
  • Branches: Branches are different version of the code that are created by the user. Someone can create a copy of the master branch or other branches on the same repository.

Master Branch

When you first create a repository, there is a default branch called Master. It is strongly recommended that code that has been tested and works goes in Master. CODE THAT HASN'T BEEN TESTED YET AND/OR DOES NOT WORK SHOULD NOT GO INTO MASTER. PUT IT IN ANOTHER BRANCH Creating different branches when you want to make a change allows you to always have a copy of the code that works. This can be very helpful and life saving during competitions.