EXPERIMENT 2
AIM : Study of Version Control System/Source Code Management, install git and create
a GitHub Account.
THEORY :
Introduction to Version Control Systems
A Version Control System (VCS) is a tool that helps manage changes to source code over
time. VCS is essential for software development, allowing multiple developers to
collaborate on projects, track changes, and maintain a history of modifications. There are
two main types of VCS: centralized and distributed.
1. Centralized Version Control System (CVCS):
○ Examples: Subversion (SVN), CVS
○ Characteristics: In CVCS, there is a single central repository where all the versioned
files are stored. Developers check out files, make changes, and commit back to the
central repository.
○ Pros: Simple to understand, single source of truth.
○ Cons: Single point of failure, requires constant network access.
2. Distributed Version Control System (DVCS):
○ Examples: Git, Mercurial
○ Characteristics: Every developer has a complete copy of the repository. Changes are
made locally and can be pushed to or pulled from other repositories.
○ Pros: No single point of failure, supports offline work, facilitates p0l0 branching and
merging.
○ Cons: More complex than CVCS.
Reasons Why VCS is Critical for DevOps
1. Collaboration and Teamwork
● Concurrent Development: Multiple developers can work on the same codebase
simultaneously without overwriting each other’s changes. This concurrent
development is managed through branches and merges.
● Code Reviews: VCS platforms like GitHub facilitate code reviews, where team
members can discuss changes, suggest improvements, and ensure code quality
before merging into the main branch.
2. Change Management
● Tracking Changes: Every change to the code is recorded with a timestamp, author,
and commit message. This makes it easy to track what changes were made, by
whom, and why.
● Revert Changes: If a bug is introduced, it’s easy to revert to a previous stable state.
This rollback capability is crucial for maintaining a stable production
environment.
3. Disaster Recovery and Backup
● Data Integrity: With a distributed VCS like Git, every developer has a full copy of
the repository, which acts as a backup. This redundancy ensures that the codebase
is not lost even if the central server fails.
● Auditing and Compliance: VCS provides a detailed history of changes, which is
valuable for auditing and complying with industry regulations and standards.
4. Code Quality and Standards
● Static Analysis and Code Quality Tools: Integration with tools that perform static
code analysis, linting, and other quality checks helps maintain high code
standards.
● Automated Testing: VCS systems integrate with automated testing frameworks to
run unit, integration, and end-to-end tests, ensuring that changes do not introduce
new bugs.
Source Code Management Using Version Control System:
Source code management (SCM) using a version control system (VCS) involves several
key practices and tools to manage changes to source code effectively. At its core, SCM
ensures that all modifications to the codebase are tracked, documented, and synchronized
among team members, enabling smooth collaboration and maintaining code integrity. In
SCM, the process typically begins with the creation of a repository, which serves as a
storage location for all project files and their history. This repository can be local, on a
developer's machine, or remote, hosted on platforms like GitHub, GitLab, or Bitbucket.
The remote repository acts as the central hub for all changes, ensuring that everyone on
the team has access to the latest version of the code. Developers work on their own
copies of the project, known as local repositories. They make changes, test new features,
and fix bugs in isolated branches. Branching allows developers to work on separate parts
of the project simultaneously without interfering with each other’s work. Once changes
are made, they are committed to the local repository. A commit records a snapshot of the
changes along with a message describing what was done and why. Continuous
Integration (CI) and Continuous Deployment (CD) are often integrated into the SCM
process. CI tools automatically build and test the code whenever changes are pushed to
the repository, ensuring that new commits do not break the existing functionality. CD
extends this by automatically deploying the tested code to staging or production
environments, enabling rapid and reliable delivery of new features and fixes. SCM also
includes handling conflicts that arise when multiple developers modify the same part of
the code. VCS tools provide mechanisms for resolving these conflicts by allowing
developers to compare differences and decide how to merge the changes.
How To Install Git Bash On Windows:
Download Git Bash
Step 1: Visit the Official Git Bash
Website Step 2: Bash Download
Install Git Bash
Step 3: Run the Installer
Step 4: Select Destination Location
Step 5: Select Components
Step 6: Select Start Menu Folder
Step 7: Choose the Default Editor used by Git
Step 8: Adjust your PATH Environment
Step 9: Choose HTTPS Transport Backend
Step 10: Configure the Line Ending Conversions
Step 11: Configure the Terminal Emulator to use with Git
Bash Step 12: Configuring Extra Options Configuring Extra
Step 13: Wait for Installation
Step 14: Complete the Git Setup Wizard
Git is an open-source version control system for tracking source code changes when
developing software. It keeps a commit history which allows you to revert to a stable
state in case you mess up your code. Gitalso allows multiple developers to collaborate on
the same code base.
Bash is a Unix command-line shell. The name is an acronym for the ‘Bourne-Again
Shell’. It comes with useful Unix commands like cat, ssh, SCP, etc., which are not
usually found on Windows.
Download Git Bash
Step 1: Visit the Official Git Bash Website
Download the latest version of Git Bash from their official website: [Link]
Click the “Download for windows” button.
Step 2: Start Git Bash Download Next, you will be redirected to a page that lets you
know that you are about to start downloading.
Install Git Bash
Step 3: Run the Installer
Once you have downloaded the Git Bash executable, click it to run the installer.
Click “Next” after you have read the license.
Step 4: Select Destination Location
Next, select the location you want to install Git Bash. I would recommend you just leave
the default option
as it is, and click “Next”.
Step 5: Select Components
Choose the components you want to install, or you can just proceed with the default
options and click “Next”. I prefer selecting the “Additional icons” component which
creates a Git Bash shortcut on the desktop.
Step 6: Select Start Menu Folder
You can change the name of the start menu folder here if you want, or just leave the
default name and click “Next”.
Step 7: Choose the Default Editor used by Git
Next, select the default editor for Git to use. Choose the one you like and click “Next”. I
would
I recommend you proceed with Nano or Notepad++. Don’t proceed with the default
option “Vim” as
ithas a steep learning curve.
Step 8: Adjust your PATH Environment
Choose the option you want depending on where you want to use Git and click “Next”.
Select “Use Git from Git Bash only” option if you want to run Git and Bash commands
from Git Bash only. This means that you won’t be able to run Git commands such as git
status on Windows CommandPrompt or Power shell. They will only be found on Git
Bash.
Select “Git from the command line and also from 3rd-party software” option if you want
to run Git commands on Windows Command Prompt or Power shell.
Select “Use Git and optional Unix tools from the Command Prompt” option if you want
to use both Git and Bash commands on Windows Command Prompt or Power shell. This
option will override some default Windows Command Prompt tools like find and sort. I
don’t use CMD or Power shell that much to worry about that. So, I will go ahead with
this option by clicking “Next”.
Step 9: Choose HTTPS Transport Backend
Next, select “Use the OpenSSL library” and click “Next”.
Step 10: Configure the Line Ending Conversions
Select how Git should treat line endings in text files. It’s probably safe to go with the
default option “Checkout Windows-Style, commit Unix-style line endings”. Click “Next”
to proceed.
Step 11: Configure the Terminal Emulator to use with Git Bash
Next, select the terminal emulator you want Git Bash to use. I will proceed with the
default option “Use MinTTY(the default terminal of MSYS2) and click “Next”.
Step 12: Wait for Installation
Now, wait for a few minutes as the Setup Wizard installs Git on your computer.
Step 15: Complete the Git Setup Wizard
After the installation has finished, check the “Launch Git Bash” and click “Finish” to
launch Git Bash.
GitHub Account Dashboard
Now that the GitHub account is all set up, you can log in through your credentials on the
website. Logging in will land on the GitHub dashboard which is personalized for
everyone according to their interests.
CONCLUSION: Hence, we have Understood Version Control System/Source Code
Management and install git and create a GitHub account.