What is GIT
Git(Global Information Tracker) is a distributed version control system used to track changes in source code.
It helps us understand what changes were made, who made them, and when they were made by maintaining a complete version history of files.
Git was created by Linus Torvalds in 2005.
Version control system
A Version Control System (VCS) is a software tool that tracks and manages changes to files, primarily source code.
It acts as a history log for a project, allowing developers to compare versions and revert to earlier states if errors occur.
Types of Version Control Systems
There are three types of version control systems:
1. Local VCS
In a Local VCS, versions are stored only on a single computer.
Example:
Manual file backups (copy–paste folders)
Limitations:
- No collaboration
- Risk of data loss
2. Centralized VCS
In a Centralized VCS, a single central server stores the project.
All developers connect to this server to get and update code.
Example:
SVN (Subversion)
How it works:
One central server contains the code.
Developers checkout, commit, and update files from the server.
3. Distributed VCS
In a Distributed VCS, every developer has a full copy of the repository, including the complete history.
Examples:
Git
Advantages:
- Each developer has complete history
- Can work offline
- Changes are pushed later to platforms like GitHub or GitLab
How git works
A Git process flow diagram illustrates how changes move between different environments using specific commands.
Working Directory → Staging Area → Local Repository → Remote Repository
- Files are edited in the Working Directory
-
git addmoves changes to the Staging Area -
git commitsaves changes into the Local Repository -
git pushsends commits to the Remote Repository (GitHub/GitLab)
Working Directory
The working directory is the place where developers modify project files before staging and committing them to Git.
Staging Area
The staging area is an intermediate area where changes are reviewed and added before committing them to the local repository.
Repository
A repository is a storage location where Git tracks all versions of a project’s files and maintains its full history.
Local repository:
A local repository is a Git repository that exists on our computer where changes are committed before being pushed to a remote repository.
Remote repository:
A remote repository is an online Git repository hosted on platforms like GitHub or GitLab.
What is GitLab
GitLab is an online platform that hosts Git repositories, allowing developers to manage code, collaborate on our Git projects online.
How to connect Git with GitLab
1. Create a repository on GitLab
2. Connect your local repo:
git remote add origin https://gitlab.com/username/portfolio.git
git push -u origin main
3. Now your local changes are visible on GitLab.



Top comments (0)