Our Notes

Posts about research, open source and technologies.

Git Fundamentals

Git is a Distributed Version Control System (DVCS), a tool used to develop and maintain software. It allows you to develop software in incremental steps and gives you a view of the project's history. As a developer, this is useful as once you learn the fundamentals, you will have an easier time keeping track of your work.

Prerequisites

  • Git is installed locally
  • Github / Gitlab account

Without going into much detail, the Git model has two levels, Staging and History. Staging is where current work resides. History is a ledger of all the changes that have been made in the project. The way Git works is that at any point in time, there will be a remote copy of the project (hosted on Github / Gitlab) and several copies of the project (typically in developers' machines). As developers work on features, these changes are first made locally and then synchronized to the remote repository. This allows for effective collaboration and provides a safety net in case something happens to a machine that contained work.

Basics & Example

  • To get started, create a repository on Gitlab and then clone it to your local machine.
  • Here are the commands we will be going over for basic workflow:
    • git status
    • git add
    • git commit
    • git push

Let’s use a simple python function as an example, start by creating a file calculator.py and add:

Sign up to receive a monthly summary.