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.
- 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:
Let’s use a simple python function as an example, start by creating a file
calculator.py and add: