Day 15 Of Flutter - Understanding The Basics Of Git And How It Works
Table of contents
What Is Git?
Git is a piece of computer software that helps developers manage changes to a codebase at different times. Git allows multiple developers to work on the same project simultaneously and keeps track of the changes made by each of them. It also keeps track of every change made and the details of the change.
Git Repository
A Git repository acts as a container/storage location that holds your project's source code and related files. A repository contains a collection of files and directories and a history of changes made to the files over time. Since Git tracks the changes made by each developer in a repository, it makes it easy to collaborate and avoid conflicts. To turn your project into a repository on your computer, you use the git init .
command in your project's directory after installing Git.
Commit
In Git, a commit is when you save the current changes made in your project. These changes could take any form, from adding and deleting files to modifying existing ones. A commit saves your changes to the project's history, allowing the developer to track their progress and revert to previous versions of the project if need be. Each commit has a unique identifier, the developer's ID, the date and time of the commit, and a commit message attached to it. To check the commits made in a project's repository, we use git commit -m "message"
.
Branches
Because Git permits multiple developers to work on a project simultaneously, a branch acts as a separate copy of the project's code and allows a developer to work on features or bug fixes without affecting the master branch or other branches. Once the developer is done with whatever they were working on in the branch they created and is sure about it, they can merge it back into the main codebase to incorporate their changes into the project.
GitHub
GitHub, similar to Dart's package manager is a web-based cloud service that hosts your Git repositories. Git enables developers to store and collaborate on code remotely.
Subscribe to my newsletter
Read articles from Makafui Tsagli directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Makafui Tsagli
Makafui Tsagli
New to Software Development, currently learning Flutter.