Git Basics
This guide will go over some basic Git concepts you’ll use in Coalesce.
What is Git?
Git is a distributed version control system that helps developers track and manage changes to their code over time.
There are different version control methods including Git, Apache Subversion, and Mercurial. Coalesce uses Git for version control. Git is supported by many providers including:
- GitHub
- Azure DevOps
- Bitbucket
- GitLab
You'll see the term Git used throughout these guides to mean the version control system, and not GitHub. These methods should be applicable to any other version control system using Git.
The main functions of Git you’ll use are:
- Repository
- Stage
- Commit and Push
- Branch and Merge
Repository
A repository is where you keep your code. There are two types:
- Local - On your computer and typically not accessible by others.
- Remote - A shared repository where others will contribute work. Such as GitHub or GitLab.
A typical workflow will mean a central remote repository that you have cloned locally. You make your changes locally then push them to the remote repository to contribute to the overall code.
In Coalesce, when you create a project, you’ll need to provide a URL to the remote repository so Coalesce can keep it updated with the changes you make.
Stage
Stage means you’ve selected which changes you want to go into your next commit. Selecting your changes in the Git Modal means you’re staging your changes.
Commit and Push
In Coalesce, we run your commit and push at the same time.
Commit means you take a record or “snapshot” of your local repository at that time. When making a commit, a commit message describes the changes made. It’s required in Coalesce to make a push.
Push means taking the local commits you made and sending them to your remote repository. The remote repository is the central location where all code and changes are stored.
When you click Commit and Push, Coalesce runs both of these at the same time.
Branches and Merge
Branches are where you’ll do your work. Typically you’ll create a branch off the main or feature branch. A branch contains changes made. A branch can be local or remote. A good workflow is to periodically commit and push your local changes to your remote branches. Then once you’re ready, merge your branch into the main feature branch.
Merge means adding your branch changes into another branch. Typically you’ll merge into the main branch.