0% found this document useful (0 votes)
7 views34 pages

Git - Version Control Systems

The document provides an overview of Git, a distributed version control system created by Linus Torvalds in 2005, highlighting its importance for collaboration, backup, and code management. It details the installation process for Git and Visual Studio Code, along with basic Git commands and branching strategies. Additionally, it covers setting up a GitHub account, creating repositories, and using GitHub Actions for CI/CD automation.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views34 pages

Git - Version Control Systems

The document provides an overview of Git, a distributed version control system created by Linus Torvalds in 2005, highlighting its importance for collaboration, backup, and code management. It details the installation process for Git and Visual Studio Code, along with basic Git commands and branching strategies. Additionally, it covers setting up a GitHub account, creating repositories, and using GitHub Actions for CI/CD automation.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 34

(Git - Version Control)

By: Suraj PV
ABOUT ME
I currently Work at: Suketa Technology Solutions

Title: Software Engineer

Expertise:
• Python
• GenAI
• Neo4j (Graph DB)
• Cloud (Microsoft Azure)
Currently working on: Anansi – A Visual Data Lineage
Tool
Git is a distributed version control
system (DVCS) used to track changes
in source code during software
development.
INTRODU
CTION TO Created by -> Linus Torvalds in 2005
GIT
Git (Full Form) -> Global Information
Tracker
Track Changes Efficiently

WHY DO Collaboration Made Easy

WE NEED
VERSION Backup & Recovery

CONTROL Branching & Merging

SYSTEMS
?
Accountability & Blame Tracking

Supports Continuous Integration &


Deployment (CI/CD)
A Version Control System (VCS), also known
as source control, is a tool that helps
developers track, manage, and collaborate on
changes to software code over time.

WHAT IS TYPES:
1. Local Version Control
VERSION 2. Centralized Version Control (CVCS)

CONTROL 3. Distributed Version Control (DVCS)

SYSTEMS ADVANTAGES:
4. Keeps a history of code changes.
(VCS)? 5. Enables collaboration among multiple
developers.
6. Helps in code recovery and rollback to
previous versions.
7. Reduces the risk of code conflicts and errors.
A local version control system (LVCS) stores project
data on a single computer.
It's the simplest type of version control system
(VCS) and is often used by individual developers.

LOCAL
VERSION
CONTROL
SYSTEMS
CENTRALIZ
ED
VERSIONS
CONTROL
SYSTEM
E XA M P L E S : APAC H E
S U BVE R S ION (S VS ) &
C ON C U R R E N T VE R S I ON S
Image Source: https://blog.stackademic.com/
S Y S T E M (C VS ):
DISTRUBUT
ED
VERSION
CONTROL
SYSTEM
EXAMPLES : GIT &
MERCURIAL

Image Source: https://blog.stackademic.com/


WHY GIT?
HANDS ON
INSTALLING GIT
1. Visit the official Git website:
https://git-scm.com/downloads
2. Choose your appropriate OS & Version:
 Windows: Download Git from the above website and
follow the standard installation process.
 Mac & Linux: Install Git via the command line using
the appropriate package manager.
INSTALLING VS CODE
1. Visit the official site of Visual Studio
https://code.visualstudio.com/Download
2. Choose the appropriate version based on OS and
click on Download.
CREATION OF PROJECT
IN VS CODE
1. Open VS Code: Launch Visual Studio Code on your
computer
2. Open a Folder:
 Click on File in the top menu
 Select Open Folder...

3. Select a Folder:
 Create a New Folder where project needs to be saved or
choose the existing folder where your project is located.
INTIALISING A LOCAL REPOSITORY
AND USING BASIC GIT COMMANDS
1. Initialize a local repository: git init

2. Creation of Text File & Check repository status: git status

3. Set up Git (First Time only)


 git config –global user.name “Your Name”
 git config –global user.email : “you.email@example.com”

4. Stage changes: git add .

5. Check repository status again: git status

6. Commit changes: git commit –m “Commit Message”

7. Check repository status after commit: git status

8. View commit history: git log

9. Make changes, stage, and commit again: Make changes to file and perform git add .
and git commit

10. git diff – View Changes

11. Ignoring files with .gitignore: Create a .gitignore file to exclude files from version
control
GIT
ARCHITECTU
RE
(3 STAGES)

Image Source:
https://www.edureka.co/blog/git-tutorial/
BREAK AND
QUESTIONS
QUIZ
GITHUB
GitLab: A comprehensive platform for
version control, issue tracking, and project
ALTERNA management.

TIVES TO Bitbucket: A web-based version control


repository that supports Git and Mercurial.
GITHUB Local Installation of Git Server: Host
your own Git server for greater control and
security.
SETTING UP A GITHUB
ACCOUNT
1. Go to GitHub and Sign Up.
2. Enter username, email, and password.
3. Verify your email and complete setup.
CREATING A GITHUB
REPOSITORY
1. Log in to GitHub.
2. Click the “+” icon → “New repository”.
3. Enter Repository Name and choose Public.
 Options: Public and Private
4. (Optional) Add README, .gitignore, and License.
5. Click “Create Repository”.
PUSH LOCAL REPO TO
GITHUB
1. Link Local repo to Github
 git remote add origin <GitHub-repo-URL>

2. Push Local Repo to Github


 git push –u origin main

3. Sync with Github:


 git pull
•A branch in Git is an independent
workspace where you can make changes
without impacting the main code.
•It allows multiple developers to work on
different branches simultaneously.
Types of Git Branches
GIT 1. Main Branch

BRANCHE 2. Feature Branches

S 3. Bugfix Branches
4. Release Branches
Creating a Branch
Create a new branch
git branch <branch_name>
Create & switch to new branch

BRANCHI git checkout -b <branch_name>

NG AND Merging Changes:

MERGING Switch to main branch


git checkout main

Merge feature branch


git merge <branch_name>
CREATE A NEW BRANCH
AND PUSH CHANGES
1. Checkout to the branch called Develop
git checkout develop # Switch to the 'develop' branch
(Alternatively, you can use git checkout –b develop it will create branch and
also switches it)
2. Make your changes
 Create a New Text File
 Modify the existing text file created before
3. Stage and Commit Changes
git add <filename>
git commit –m <Commit_Message>
4. Push the Changes to Github
git push origin develop
5. Create a Pull Request & Merge
PULL REQUEST
BREAK AND
QUESTIONS
Create a
TASK: static web
page using
Add a
Header,

CREATE A HTML and


CSS.
Body and
Footer.

BASIC You can do this


STATIC manually or copy code
WEBPAGE from online and run it
locally.
What is GitHub Actions?
1. A built-in CI/CD automation tool in GitHub
2. Helps automate workflows like testing, building, and
deploying code

GIT Deploy Static Website using Github Actions

ACTIONS
1. Go to your GitHub repository.
2. Click on the "Actions" tab.
3. Select a workflow template or create a new workflow
(.github/workflows/). (HTML Workflow)
4. Commit and push the file—GitHub will run the workflow
automatically!
5. Verify the deployment - Once the workflow runs successfully,
your static website should be deployed (for example, via
GitHub Pages if you used that deployment method).
DEPLOYMENT
USING GITHUB
ACTIONS
Git Command Line Interface:
Initializing a local repository
Basic Git commands (add, commit,
log, status)
Pushing and pulling changes
GitHub:
REVIEW Creating a repository
Linking local repository to GitHub
Pull requests and code review
GitHub Actions:
Automating workflows and CI/CD
pipelines
Command Description
git init Initializes a new local Git repository.
git clone <repo_url> Creates a local copy of an existing remote
repository.

BASIC GIT
git add <file> Adds changes in a file to the staging area.
Use git add . to add all changes.
git commit -m Saves changes to the repository with a
"message" meaningful message.
Shows the status of files (tracked,
COMMAN
DS
git status
untracked, modified, staged).
git push origin Uploads local branch changes to the remote
<branch> repository.
git pull origin Fetches the latest changes from the remote
<branch> repository and merges them.
Displays the commit history of the
git log
repository.
Command Description
git branch Lists all branches in the repository.
git checkout
Switches to another branch.
<branch>

git merge <branch>


Merges changes from another branch BASIC GIT
git reset <file>
into the current branch.

Un stages a file from the staging area.


COMMAN
git revert
<commit_id>
Reverts a specific commit by creating a
new one.
DS
git stash
Temporarily saves changes without
committing them.
CONT’D
Email –
suraj.pv@suketa.in

CONTACT
US LinkedIn -
www.linkedin.com/in/su
rajpv/

You might also like