Git:
Introduction to Git
Persistent University
Key Learning Points
o What is VCS?
o What is Git?
o Centralized vs Distributed VCS
o Installing Git on Windows
o Configuring Git
Confidential © 2020 Persistent Systems
Git Introduction
What is DevOps?
DevOps is:
The practice of operations and Characterized by operations A culture of trust and
development engineers staff making use many of collaboration in which people
participating together in the the same techniques as use right Tools for automation to
entire service lifecycle, from developers for their systems achieve Continuous Delivery
design through the development work. and Continuous Deployments.
process to production support.
Confidential © 2020 Persistent Systems 4
Project Execution Methodologies
Agile Waterfall
Design
Code
Test
Deploy
Waterfall
Design Code Test Deploy
Agile
Design Code Test Code Test Code Test Code Test Deploy
DevOps
Design
Confidential © 2020 Persistent Systems 5
DevOps Lifecycle
Continuous Business
Planning
Collaborative
Collaborative
Customer Feedback
Development
& Optimization
DevOps
Continuous Continuous
Monitoring Testing
Continuous Release
and Deployment
Confidential © 2020 Persistent Systems 6
DevOps Lifecycle
Continuous Business Collaborative Continuous
Planning Development Testing
Collaborative Customer
Continuous Continuous Release
Feedback &
Monitoring and Deployment
Optimization
Confidential © 2020 Persistent Systems 7
DevOps Tools
DevOps Tools Market Map
Source Code Management Containers
D
O
e
Continuous Integration Configuration Management p
v
e
e Build
r
l
a
o Deployment t
p
i
m
o
e
Testing
n
n
Monitoring s
t
Confidential © 2020 Persistent Systems 8
Development to Deployment Pipeline: Workflow
Business Need/ Managing
Use Case Client Nodes
Software Automated
Development Team Deployment
Automated Automated
Software Check-in
Software Build Test Scripts
Confidential © 2020 Persistent Systems 9
Disorganized Project
“Hey, Jim, could you send “Merry, this function doesn’t
me a copy of those changes work anymore. Did you
you made last day?” change something?”
“Oh!!! Sorry, I can’t seem to “Ok, we’ve all been working
find those old classes. hard for the last week.
I guess you’ll just have to re- Now let’s integrate everyone’s
implement them.” work together.”
Confidential © 2020 Persistent Systems 10
What is Version Control? (contd.)
Overview Version Control Systems Newer Systems
Version control (or revision Some well-known version control Distributed systems like
control, or source control) is all systems are CVS, Subversion, Mercurial and Git are newer
about managing multiple versions of Mercurial, and Git. and are gradually replacing
documents, programs, web sites, etc. centralized systems like CVS
• CVS and Subversion use a
and Subversion.
• Almost all “real” projects use some “central” repository; users
kind of version control. “check out” files, work on them,
and “check them in”.
• Essential for team projects, but
also very useful for individual • Mercurial and Git treat all
projects. repositories as equal.
Confidential © 2020 Persistent Systems 11
Benefits of Version Control
Basic Functionality: Benefits:
• Keep track of changes made to files • Facilitates backups
(allows roll-backs)
• Increased productivity
• Merge the contributions of multiple developers (vs manual version control)
• Encourages experimentation
• Helps to identify/fix conflicts
• Makes source readily available –
Less duplicated effort
Confidential © 2020 Persistent Systems 12
History
• Created by Linus Torvalds for work on the Linux kernel ~ 2005.
• Some of the companies that use Git:
Confidential © 2020 Persistent Systems 13
Git is a Distributed
What is Git?
Version Control System
Confidential © 2020 Persistent Systems 14
Benefits of Git
• Git is distributed.
• Most operations in Git only need local files and resources to operate, every operation in Git is local.
• Everything in Git is check-summed before it is stored i.e. It has integrity.
• The Three States – The Git working directory, The staging area and Repository.
• Everyone has the complete history.
• Everything is done offline.
• No central authority.
• Changes can be shared without a server.
• The entire history of the project right there on your local disk, most operations seem almost instantaneous.
• If no access to server or VPN, no need to wait till we get the access because everything is available locally
if not take it from your friend (peer).
Confidential © 2020 Persistent Systems 15
Centralized VC vs. Distributed VC
Central Server Remote Server
Confidential © 2020 Persistent Systems 16
Centralized Version Control
Computer A Central VCS Server
Checkout
Version Database
File
Version 3
Version 2
Computer B
Checkout
Version 1
File
Confidential © 2020 Persistent Systems 17
Distributed Version Control
Computer A
Server Computer
File
Version Database
Version Database Version 3
Version 2
Version 3
Version 1
Version 2 Computer B
File
Version Database
Version 1 Version 3
Version 2
Version 1
Confidential © 2020 Persistent Systems 18
Distributed: Snapshots
• Database is stored on
your local machine Check-ins over time
• Must “checkout” from
database into working Version 1 Version 2 Version 3 Version 4 Version 5
directory to edit
• Must “commit” from
working directory into
A A1 A1 A2 A2
database
• Stored in Git database
in compressed format
B B B B1 B2
• Files are stored by
SHA-1 hash rather than
filename
• In this example, files A, C C1 C2 C2 C3
B and C are tracked
Confidential © 2020 Persistent Systems 19
Local Operations
Why might you want to stage files?
Working Staging Git Directory
Directory Area (Repository)
Checkout the project
Stage files
Commit
Confidential © 2020 Persistent Systems 20
Getting Started: The Command Line
• There are a lot of different ways to use Git.
• There are the original command line tools.
• There are many graphical user interfaces of varying capabilities.
• For now, we will be using Git on the command line.
• Before we start using Git, we have to make it available on computer with below download link:
- [Link]
Confidential © 2020 Persistent Systems 21
Installing GIT
[Link]
Try Git Online..!!!
Awesome ..!!!
Download Git
Confidential © 2020 Persistent Systems 22
FAQs
• What is Version Controlling?
• What is SVN and its Pro’s and Con’s?
• History of Git?
• What is Git?
• Benefits of Git over other Version Controlling Tools?
• How Git works – Three States?
Confidential © 2020 Persistent Systems 23
Summary
• With this we have come to an end of our first session, where we discussed about.
- What is Git?
- Benefits and working of Git.
• At the end of this session, we see that you are now able to answer following questions:
- What is Version Controlling?
- How Git is Distributed Version Control?
- What are the states in Git?
• In the next session we will discuss about.
- Working with Git and Local Operations on Git.
Confidential © 2020 Persistent Systems 24
Reference Material: Websites & Blogs
• [Link]
• [Link]
• [Link]
• [Link]
• [Link]
Confidential © 2020 Persistent Systems 25
Reference Material: Books
Pro Git Version Control with Git
• By Scott Chacon and Ben Straub • By Jon Loeliger, Matthew McCullough
• Publisher: Apress • Publisher: O'Reilly Media
Confidential © 2020 Persistent Systems 26
Key Contacts
Git Interactive Vice President
Vaishali Khatal Shubhangi Kelkar
shubhangi_kelkar@[Link]
vaishali_khatal@[Link]
Asif Immanad
asif_immanad@[Link]
Confidential © 2020 Persistent Systems 27
Thank you!
Persistent University