Git is a free and open-source distributed version control system that can handle everything from tiny to extremely large projects quickly and efficiently. It was developed in 2005 by Linus Torvalds, creator of Linux Operating System. Before we get started with the Git concept, let’s go over some terminologies that were used before the introduction of GitHub.
Source Code Management
When we first start the software development process, we must be familiar with terms like source code management. It is concerned with the code that we use in software development. When an application is constructed, for example, a Flipkart, all the modules will not be designed by a single developer, the operations and features will be subdivided and completed by multiple developers.
Significance of Source Code Management Tool
Developers will share the code to the manager, and the manager will have to track the code, track the completion status, and manage the code. It is tough for the manager to track the code. Source code management technologies were designed to address this issue. A system for keeping track of file modifications. Allow many members of your team to work on the same file at the same time.
Provides a method for resolving conflicts when multiple team members change the same line in a file. Team member 1 would make updating and Team member 2 would save over Team member 1’s work, erasing the changes. Version Control System is the duty of SCM as a safety measure against this specific circumstance.
What is Version Control System
Version control systems are a type of software that aids software development teams in managing source code changes over time, assists teams in resolving such issues by recording each individual change made by each contributor and preventing concurrent work from conflicting. updates made in one portion of the software may be conflicting with those made by another developer working on the same project at the similar time. This issue should be identified and resolved in a timely way without interfering with the work of the rest of the team.
Types of Version Control
The two types of version control systems are “centralised” and “distributed.” In software development, centralised version control systems (CVCSs) and distributed version control systems (DVCSs) serve various purposes.
Centralized version control system
- In CVCSs, a client needs to get local copy of source code from server, do the changes and Commit those changes to Central Source on Server,
- CVCSs system are easy to learn and Setup
Some of the Drawbacks of CVCSs system
- Working on Branches is difficult in CVCSs Developer often faces merge conflict.
- CVCSs System do not provide offline access
- CVCSs is slower as every command need to communicate with server.
- If CVCSs server is down developers cannot work.
To address the concerns raised by CVCSs, we chose Distributed Version Control System (DVCSs).
In Distributed Version Control System (DVCSs), each contributor has a local copy or “Clone” of the main repository, which contains all the files and metadata contained in the main repository.
- DVCSs are tough since several instructions must be remembered.
- Working on branches is easier among DVCS developers since there are less conflicts.
- As a client replicates the complete repository on the local machine, the DVCS system works perfectly in offline mode.
- DVCS is quicker since most users deal with local copies rather than accessing the server every time.
Git is Distributed version control system and it is a open source software.
Stages in Git workflow and its terminologies
Let’s start with what repositories are, and then we’ll go through all the terminologies used in Git one by one,Git uses different strategy ,it does track each and every modified file whenever you do commit an operation.
- Repositories: Repositories is a place where you have all your Codes or kind of folder on server
- Working Directory: Working directory is where you see files physically and do modification.
- Staging area: Git looks for the files present in the staging area only those files present in the staging area are considered for commit and not all the modified files.
- Local repo: The local repository is a Git repository that is stored on your computer
- Remote repository: The remote repository is a Git repository that is stored on some remote computer(Git Hub).
Commands used in these stages
Git init: Command is one way to start a new project with Git.
Git add : Command adds a change in the working directory to the staging area
Git Commit: Command Commits all files from the staging area to local Repository
Git Push: Command Pushes all the changes made in local to Remote Repository.
Git Pull: Command Collects the changes from Remote Repository and copies them to Local Repository along with merges to the current directory or our workspace
Install Git on Windows
Step 1: Downloads the Git
Step:2 –Make New Folder as Git
- right Click and Open the Git Bash
Step 3: Add File of the Project
Step 4: Create New Repository
Step 5 : GIT REPO After Creation
Step 6 : Git Commit
Step 6 : Git Push and Check in GitHub Repository
Free and open source fast and small as most of the operations are performed locally, therefore it is fast ,uses cryptographic hash function called secure hash functions(SHA1)to name and identity objects with its database.