SlideShare a Scribd company logo
1 of 41
Git Version
Control and
Trunk based
with VSTS
Murughan Palaniachari
Murughan Palaniachari
Principal Consultant – DevOps and Blockchain
Organizer of
Cloud and DevOps meetup
Technical Agility Conference
http://aidevdays.com/
http://www.containerconf.in/
https://elevate-org.com/
https://devopsgames.com/
https://in.linkedin.com/in/murughan
@Murughan_P
With my Guru – John Willis & Jez Humble
Products/Services
TFS/VSTS
+ Azure
@Murughan_P
What is Visual
Studio Team
Services?
• It’s a source control system!
• Wrong. It is FAR more than a source control
system.
• Everything you need to create software.
From application inception to application sun
setting.
• DevOps Collaboration Hub
• Key Functional Areas
• Agile Planning & Management/Work Item
Tracking
• Version Control
• Build Management & Automation
• Testing
• Release Management
• Application Monitoring
@Murughan_P
REQUIREMENTS
Plan
Develop + Test Release
Business
Product Owners
Developers
Testers
Operations
+ all other
Stakeholders
Backlog
Enabling Value Delivery
@Murughan_P
Agenda –
Version Control
• Version Control Overview
• Centralized Version Control
• Distributed Version Control
• Git Overview
• Pre-requisites
• Git Installation
• Git Commands
• Branching, Merging, Rebase
• Trunk based approach
• Pull request
• Code review
• Workshop with sample Python Application
@Murughan_P
Training
Exercises
• Exercise 1: Practise Git commands – command
line
• Exercise 2: Create Git repository in VSTS, clone
it, git commands through Visual Studio
• Exercise 3: Trunk based approach, create
branch, create pull request and approve.
• Exercise 4: Unit testing with Unittest python
for sample Phonebook app
• Exercise 5: Mock data with Unittest Mock
package python for sample bank accounts app
• Exercise 6: TDD for sample Calculator app
• Demo: UI Testing with Selenium Web Driver
python
@Murughan_P
Version
Control
@Murughan_Phttps://app.pluralsight.com/library/courses/tfs-visual-studio-2015-implementing-continuous-delivery/table-of-contents
Version Control
• Version Control as Fundamental Enabler of Continuous Delivery
• One single source of truth for everything
• Manage your daily tasks
• Create
• Save
• Edit
• Save again
• Collaborative History tracking
• What changes
• Why was things changed – comments
• Compare the changes
• Who has made change
https://git-scm.com/ @Murughan_P
Centralized Version Control
@Murughan_P
Git - Distributed Version Control
• Git is a fast and modern implementation of Version Control
• Git is a fast, scalable, distributed revision control system with an
unusually rich command set that provides both high-level operations
and full access to internals.
• Git provides a history of content changes
• Git facilitates Collaborative Changes to files
• East to use for anyone and any knowledge worker
• Local Git
• Easy to learn
https://git-scm.com/ @Murughan_P
Git - Distributed Version Control
https://app.pluralsight.com/library/courses/tfs-visual-studio-2015-implementing-continuous-delivery/table-of-contents
@Murughan_P
Principle - Keep everything in Source Control
https://www.edx.org/course/introduction-devops-transforming-linuxfoundationx-lfs161x @Murughan_P
Git Installation
• Windows
• https://git-scm.com/downloads
• Mac OSX
• https://git-scm.com/download/mac
• Linux
• https://git-
scm.com/download/linux
@Murughan_P
The Three States committed, modified, and staged
• Committed means that
the data is safely stored in
your local database.
• Modified means that you
have changed the file but
have not committed it to
your database yet.
• Staged means that you
have marked a modified
file in its current version to
go into your next commit
snapshot.
https://git-scm.com/book/en/v2/Getting-Started-Git-Basics @Murughan_P
Exercise 1
Practise Git commands – command line
@Murughan_P
Git commands list
• git
• git --version
• Prints the Git suite version that
the git program came from.
• git --help
• Prints the synopsis and a list of
the most commonly used
commands. Ex: git --help merge
https://git-scm.com/docs/git @Murughan_P
Configuring Git
Git comes with a tool called git config that
lets you get and set configuration variables
that control all aspects of how Git looks and
operates.
• System-level configuration
• git config --system
• Stored in /etc/gitconfig or
c:Program Files
(x86)Gitetcgitconfig
• User-level configuration
• git config --global
• Stored in ~/.gitconfig or
c:Users<NAME>.gitconfig
@Murughan_P
Configuring Git
• Repository-level configuration
• git config
• Stored in .git/config in each repo
• Set Identity
• git config --global user.name "John
Doe"
• git config --global user.email
johndoe@example.com
• Check your seetings
• git config --list
@Murughan_P
Git commands
• Creating a local repository
• git init sampleproject
• cd sampleproject
• Open this folder in editor and add some test files
• Adding files
• git add .
• Committing changes – local commit
• git commit -m "Creating sample project“
• Cloning app
• Git clone https://github.com/murughan1985/pythonSample.git
@Murughan_P
STAGE &
SNAPSHOT
Working with snapshots and the Git staging area
• git add [file]
• add a file as it looks now to your next commit
(stage)
• git status
• show modified files in working directory, staged
for your next commit
• git reset [file]
• unstage a file while retaining the changes in
working directory
• git diff //modify the test file
• - diff of what is changed but not staged
• git diff –staged
• diff of what is staged but not yet commited
• git commit -m “[descriptive message]”
• commit your staged content as a new commit
snapshot
@Murughan_P
Log
@Murughan_P
• show the commit history for the currently active branchgit log
• show the commits on branchA that are not on branchBgit log branchB..branchA
• show the commits that changed file, even across renamesgit log --follow [file]
• show the diff of what is in branchA that is not in branchBgit diff branchB...branchA
• show any object in Git in human-readable formatgit show [SHA]
Exercise 2
Create Git repository in VSTS, clone it, git commands
through Visual Studio
@Murughan_P
VSTS – Git tab
• Repository
• Create New Repository
• Import New repository
• Manage Repository
• Clone and Fork
• Files
• Content
• History
• Commits
• Pushes
• Tags
https://www.youtube.com/watch?v=ykZbBD-CmP8 @Murughan_P
Github – Create python Django project from visual studio and push
it to github
Workshop
Check out my blogpost on this
https://elevate-org.com/2018/05/13/create-python-django-project-from-visual-studio-and-
push-it-to-github/
@Murughan_P
SHARE & UPDATE
@Murughan_P
• add a git URL as an aliasgit remote add [alias] [url]
• fetch down all the branches from that Git remotegit fetch [alias]
• merge a remote branch into your current branch to bring it up to dategit merge [alias]/[branch]
• Transmit local branch commits to the remote repository branchgit push [alias] [branch]
• fetch and merge any commits from the tracking remote branchgit pull
TRACKING PATH CHANGES
@Murughan_P
• delete the file from project and stage the removal for
commitgit rm [file]
• change an existing file path and stage the move
git mv [existing-path]
[new-path]
• show all commit logs with indication of any paths
that movedgit log --stat -M
Git commands
• Branch
• git branch feature1
• Merge changes to master
• git merge sampleproject
• Rebase - you can take all the changes
that were committed on one branch
and replay them on another one.
• git checkout fature1
• git rebase master
• Stage - Add file contents to the staging
area
• git stage
@Murughan_P
Create VSTS
project and Git
repository.
Workshop
Check out my blogpost on this
https://elevate-
org.com/2018/05/13/configure-git-
version-control-in-vsts-and-create-push-
python-django-project-through-visual-
studio/
@Murughan_P
Branching and
Merging
• Branching means you diverge from the main
line of development and continue to do work
without messing with that main line.
• The way Git branches is incredibly lightweight,
making branching operations nearly
instantaneous, and switching back and forth
between branches generally just as fast.
• Below command create branch called feature1
from master
• git branch feature1
• Merging Join two or more development
histories together
• git merge feature1
• Staging Add file contents to the staging area
@Murughan_P
Feature Branching
@Murughan_Phttps://continuousdelivery.com/
Branch Types
@Murughan_P
Trunk based
approach
• A source-control branching model,
where developers collaborate on
code in a single branch called ‘trunk’.
• Resist any pressure to create other
long-lived development branches by
employing documented techniques.
• They therefore avoid merge hell, do
not break the build, and live happily
ever after.
@Murughan_Phttps://trunkbaseddevelopment.com/
Continuous Integration
@Murughan_Phttps://continuousdelivery.com/
Feature
Branch vs
Continuous
Integration
@Murughan_Phttps://continuousdelivery.com/
Continuous
Integration
Principle
@Murughan_P
BRANCH &
MERGE
Isolating work in branches, changing context, and
integrating changes
• git branch
• list your branches. a * will appear next to the
currently active branch
• git branch [branch-name]
• create a new branch at the current commit
• git checkout
• switch to another branch and check it out
into your working directory
• git merge [branch]
• merge the specified branch’s history into the
current one
• git log
• show all commits in the current branch’s
history
@Murughan_P
Pull request
• The pull request is the collaborative process that lets the rest
of the team discuss changes in a branch and agree to merge
them once everyone approves. Use pull requests to get early
feedback from others on work in progress, even if you're not
ready to merge the changes into another branch.
• In this image, the purple branch is merged into the blue branch
through a pull request. The changes are discussed by reviewers
in the pull request before the code is merged. When you
complete the pull request, there is a merge commit (seen here
as the filled blue commit) where the changes in the purple
branch are now merged in the blue branch.
@Murughan_P
Exercise 3
Trunk based approach, create branch,
create pull request and approve with
VSTS and Visual Studio
@Murughan_P
VSTS – Branches, Pull request
• Branches
• New Branch
• Branch Policy
• Pull request
• Create
• Approve
• Modify code
@Murughan_P
Reference/Further reading
• https://git-scm.com/docs/git
• https://trunkbaseddevelopment.com/
• https://continuousdelivery.com/
• https://app.pluralsight.com/library/courses/tfs-visual-studio-2015-implementing-
continuous-delivery/table-of-contents
• https://elevate-org.com

More Related Content

What's hot

Introduction to DevOps
Introduction to DevOpsIntroduction to DevOps
Introduction to DevOpsMatthew David
 
Agile Leadership - Beyond the Basics
Agile Leadership - Beyond the BasicsAgile Leadership - Beyond the Basics
Agile Leadership - Beyond the BasicsMark Levison, CST
 
0 to hero with Azure DevOps
0 to hero with Azure DevOps0 to hero with Azure DevOps
0 to hero with Azure DevOpsChristos Matskas
 
DevOps introduction
DevOps introductionDevOps introduction
DevOps introductionSridhara T V
 
DevOps Lifecycle | Edureka
DevOps Lifecycle | EdurekaDevOps Lifecycle | Edureka
DevOps Lifecycle | EdurekaEdureka!
 
Azure DevOps Presentation
Azure DevOps PresentationAzure DevOps Presentation
Azure DevOps PresentationInCycleSoftware
 
Devops Intro - Devops for Unicorns & DevOps for Horses
Devops Intro - Devops for Unicorns & DevOps for HorsesDevops Intro - Devops for Unicorns & DevOps for Horses
Devops Intro - Devops for Unicorns & DevOps for HorsesBoonNam Goh
 
What is Site Reliability Engineering (SRE)
What is Site Reliability Engineering (SRE)What is Site Reliability Engineering (SRE)
What is Site Reliability Engineering (SRE)jeetendra mandal
 
The DevOps Journey
The DevOps JourneyThe DevOps Journey
The DevOps JourneyMicro Focus
 
Improve the Development Process with DevOps Practices by Fedorov Vadim
Improve the Development Process with DevOps Practices by Fedorov VadimImprove the Development Process with DevOps Practices by Fedorov Vadim
Improve the Development Process with DevOps Practices by Fedorov VadimSoftServe
 
DOES SFO 2016 - Topo Pal - DevOps at Capital One
DOES SFO 2016 - Topo Pal - DevOps at Capital OneDOES SFO 2016 - Topo Pal - DevOps at Capital One
DOES SFO 2016 - Topo Pal - DevOps at Capital OneGene Kim
 
SRE-iously! Reliability!
SRE-iously! Reliability!SRE-iously! Reliability!
SRE-iously! Reliability!New Relic
 
Introducing DevOps, IT Sharing Session 20 Nov 2017
Introducing DevOps, IT Sharing Session 20 Nov 2017Introducing DevOps, IT Sharing Session 20 Nov 2017
Introducing DevOps, IT Sharing Session 20 Nov 2017Danny Ariwicaksono
 
DevOps- exec level briefing
DevOps-  exec level briefingDevOps-  exec level briefing
DevOps- exec level briefingRavi Tadwalkar
 
Kanban in software development: A systematic literature review
Kanban in software development: A systematic literature reviewKanban in software development: A systematic literature review
Kanban in software development: A systematic literature reviewMuhammad Ahmad
 
Getting Started with Azure Artifacts
Getting Started with Azure ArtifactsGetting Started with Azure Artifacts
Getting Started with Azure ArtifactsCallon Campbell
 

What's hot (20)

Introduction to DevOps
Introduction to DevOpsIntroduction to DevOps
Introduction to DevOps
 
Agile Leadership - Beyond the Basics
Agile Leadership - Beyond the BasicsAgile Leadership - Beyond the Basics
Agile Leadership - Beyond the Basics
 
0 to hero with Azure DevOps
0 to hero with Azure DevOps0 to hero with Azure DevOps
0 to hero with Azure DevOps
 
DevOps introduction
DevOps introductionDevOps introduction
DevOps introduction
 
Azure dev ops
Azure dev opsAzure dev ops
Azure dev ops
 
DevOps introduction
DevOps introductionDevOps introduction
DevOps introduction
 
DevOps Lifecycle | Edureka
DevOps Lifecycle | EdurekaDevOps Lifecycle | Edureka
DevOps Lifecycle | Edureka
 
Azure DevOps Presentation
Azure DevOps PresentationAzure DevOps Presentation
Azure DevOps Presentation
 
DevOps 101
DevOps 101DevOps 101
DevOps 101
 
Devops Intro - Devops for Unicorns & DevOps for Horses
Devops Intro - Devops for Unicorns & DevOps for HorsesDevops Intro - Devops for Unicorns & DevOps for Horses
Devops Intro - Devops for Unicorns & DevOps for Horses
 
What is Site Reliability Engineering (SRE)
What is Site Reliability Engineering (SRE)What is Site Reliability Engineering (SRE)
What is Site Reliability Engineering (SRE)
 
Devops on AWS
Devops on AWSDevops on AWS
Devops on AWS
 
The DevOps Journey
The DevOps JourneyThe DevOps Journey
The DevOps Journey
 
Improve the Development Process with DevOps Practices by Fedorov Vadim
Improve the Development Process with DevOps Practices by Fedorov VadimImprove the Development Process with DevOps Practices by Fedorov Vadim
Improve the Development Process with DevOps Practices by Fedorov Vadim
 
DOES SFO 2016 - Topo Pal - DevOps at Capital One
DOES SFO 2016 - Topo Pal - DevOps at Capital OneDOES SFO 2016 - Topo Pal - DevOps at Capital One
DOES SFO 2016 - Topo Pal - DevOps at Capital One
 
SRE-iously! Reliability!
SRE-iously! Reliability!SRE-iously! Reliability!
SRE-iously! Reliability!
 
Introducing DevOps, IT Sharing Session 20 Nov 2017
Introducing DevOps, IT Sharing Session 20 Nov 2017Introducing DevOps, IT Sharing Session 20 Nov 2017
Introducing DevOps, IT Sharing Session 20 Nov 2017
 
DevOps- exec level briefing
DevOps-  exec level briefingDevOps-  exec level briefing
DevOps- exec level briefing
 
Kanban in software development: A systematic literature review
Kanban in software development: A systematic literature reviewKanban in software development: A systematic literature review
Kanban in software development: A systematic literature review
 
Getting Started with Azure Artifacts
Getting Started with Azure ArtifactsGetting Started with Azure Artifacts
Getting Started with Azure Artifacts
 

Similar to Git version control and trunk based approach with VSTS

How to plan and define your CI-CD pipeline
How to plan and define your CI-CD pipelineHow to plan and define your CI-CD pipeline
How to plan and define your CI-CD pipelineElasTest Project
 
Beginner's Guide to Version Control with Git
Beginner's Guide to Version Control with GitBeginner's Guide to Version Control with Git
Beginner's Guide to Version Control with GitRobert Lee-Cann
 
Git for folk who like GUIs
Git for folk who like GUIsGit for folk who like GUIs
Git for folk who like GUIsTim Osborn
 
Introduction to Git and GitHub
Introduction to Git and GitHubIntroduction to Git and GitHub
Introduction to Git and GitHubVikram SV
 
Que nos espera a los ALM Dudes para el 2013?
Que nos espera a los ALM Dudes para el 2013?Que nos espera a los ALM Dudes para el 2013?
Que nos espera a los ALM Dudes para el 2013?Bruno Capuano
 
Git 101 - Crash Course in Version Control using Git
Git 101 - Crash Course in Version Control using GitGit 101 - Crash Course in Version Control using Git
Git 101 - Crash Course in Version Control using GitGeoff Hoffman
 
Git installation and configuration
Git installation and configurationGit installation and configuration
Git installation and configurationKishor Kumar
 
O'Leary - Using GitHub for Enterprise and Open Source Documentation
O'Leary - Using GitHub for Enterprise and Open Source DocumentationO'Leary - Using GitHub for Enterprise and Open Source Documentation
O'Leary - Using GitHub for Enterprise and Open Source DocumentationLavaCon
 
The Basics of Open Source Collaboration With Git and GitHub
The Basics of Open Source Collaboration With Git and GitHubThe Basics of Open Source Collaboration With Git and GitHub
The Basics of Open Source Collaboration With Git and GitHubBigBlueHat
 
Luis atencio on_git
Luis atencio on_gitLuis atencio on_git
Luis atencio on_gitLuis Atencio
 
Git Educated About Git - 20 Essential Commands
Git Educated About Git - 20 Essential CommandsGit Educated About Git - 20 Essential Commands
Git Educated About Git - 20 Essential CommandsJeremy Lindblom
 
Git basics, Team Workflows (Ciro Miranda)
Git basics, Team Workflows (Ciro Miranda)Git basics, Team Workflows (Ciro Miranda)
Git basics, Team Workflows (Ciro Miranda)Ciro Miranda
 
Fundamentals of Git
Fundamentals of GitFundamentals of Git
Fundamentals of Gitcmckni3
 

Similar to Git version control and trunk based approach with VSTS (20)

How to plan and define your CI-CD pipeline
How to plan and define your CI-CD pipelineHow to plan and define your CI-CD pipeline
How to plan and define your CI-CD pipeline
 
git Technologies
git Technologiesgit Technologies
git Technologies
 
Beginner's Guide to Version Control with Git
Beginner's Guide to Version Control with GitBeginner's Guide to Version Control with Git
Beginner's Guide to Version Control with Git
 
Mini-training: Let’s Git It!
Mini-training: Let’s Git It!Mini-training: Let’s Git It!
Mini-training: Let’s Git It!
 
Git for folk who like GUIs
Git for folk who like GUIsGit for folk who like GUIs
Git for folk who like GUIs
 
Introduction to Git and GitHub
Introduction to Git and GitHubIntroduction to Git and GitHub
Introduction to Git and GitHub
 
Que nos espera a los ALM Dudes para el 2013?
Que nos espera a los ALM Dudes para el 2013?Que nos espera a los ALM Dudes para el 2013?
Que nos espera a los ALM Dudes para el 2013?
 
Migrating To GitHub
Migrating To GitHub  Migrating To GitHub
Migrating To GitHub
 
Git 101 - Crash Course in Version Control using Git
Git 101 - Crash Course in Version Control using GitGit 101 - Crash Course in Version Control using Git
Git 101 - Crash Course in Version Control using Git
 
Git installation and configuration
Git installation and configurationGit installation and configuration
Git installation and configuration
 
GitHub Event.pptx
GitHub Event.pptxGitHub Event.pptx
GitHub Event.pptx
 
O'Leary - Using GitHub for Enterprise and Open Source Documentation
O'Leary - Using GitHub for Enterprise and Open Source DocumentationO'Leary - Using GitHub for Enterprise and Open Source Documentation
O'Leary - Using GitHub for Enterprise and Open Source Documentation
 
The Basics of Open Source Collaboration With Git and GitHub
The Basics of Open Source Collaboration With Git and GitHubThe Basics of Open Source Collaboration With Git and GitHub
The Basics of Open Source Collaboration With Git and GitHub
 
01 - Git vs SVN
01 - Git vs SVN01 - Git vs SVN
01 - Git vs SVN
 
Luis atencio on_git
Luis atencio on_gitLuis atencio on_git
Luis atencio on_git
 
Git Educated About Git - 20 Essential Commands
Git Educated About Git - 20 Essential CommandsGit Educated About Git - 20 Essential Commands
Git Educated About Git - 20 Essential Commands
 
Git tips and tricks
Git   tips and tricksGit   tips and tricks
Git tips and tricks
 
Git basics, Team Workflows (Ciro Miranda)
Git basics, Team Workflows (Ciro Miranda)Git basics, Team Workflows (Ciro Miranda)
Git basics, Team Workflows (Ciro Miranda)
 
Fundamentals of Git
Fundamentals of GitFundamentals of Git
Fundamentals of Git
 
Git & Github
Git & GithubGit & Github
Git & Github
 

More from Murughan Palaniachari

Create and Deploy your ERC20 token with Ethereum
Create and Deploy your ERC20 token with EthereumCreate and Deploy your ERC20 token with Ethereum
Create and Deploy your ERC20 token with EthereumMurughan Palaniachari
 
Write smart contract with solidity on Ethereum
Write smart contract with solidity on EthereumWrite smart contract with solidity on Ethereum
Write smart contract with solidity on EthereumMurughan Palaniachari
 
DevOps continuous learning and experimentation
DevOps continuous learning and experimentationDevOps continuous learning and experimentation
DevOps continuous learning and experimentationMurughan Palaniachari
 
DevOps ci/cd with Microsoft vsts and azure
DevOps ci/cd with Microsoft vsts and azureDevOps ci/cd with Microsoft vsts and azure
DevOps ci/cd with Microsoft vsts and azureMurughan Palaniachari
 
DevOps the phoenix project simulation
DevOps the phoenix project simulationDevOps the phoenix project simulation
DevOps the phoenix project simulationMurughan Palaniachari
 
Dev ops culture and principles of high performing organization
Dev ops culture and principles of high performing organizationDev ops culture and principles of high performing organization
Dev ops culture and principles of high performing organizationMurughan Palaniachari
 
DevOps culture in high performing organization and adoption & growth of DevOps
DevOps culture in high performing organization and adoption & growth of DevOps DevOps culture in high performing organization and adoption & growth of DevOps
DevOps culture in high performing organization and adoption & growth of DevOps Murughan Palaniachari
 
Zero downtime release through DevOps Continuous Delivery
Zero downtime release through DevOps Continuous DeliveryZero downtime release through DevOps Continuous Delivery
Zero downtime release through DevOps Continuous DeliveryMurughan Palaniachari
 

More from Murughan Palaniachari (16)

Blockchain on aws
Blockchain on awsBlockchain on aws
Blockchain on aws
 
Hyperledger Fabric
Hyperledger FabricHyperledger Fabric
Hyperledger Fabric
 
Azure Blockchain Workbench
Azure Blockchain WorkbenchAzure Blockchain Workbench
Azure Blockchain Workbench
 
Create and Deploy your ERC20 token with Ethereum
Create and Deploy your ERC20 token with EthereumCreate and Deploy your ERC20 token with Ethereum
Create and Deploy your ERC20 token with Ethereum
 
Agile scrum with Microsoft VSTS
Agile scrum with Microsoft VSTSAgile scrum with Microsoft VSTS
Agile scrum with Microsoft VSTS
 
Write smart contract with solidity on Ethereum
Write smart contract with solidity on EthereumWrite smart contract with solidity on Ethereum
Write smart contract with solidity on Ethereum
 
Blockchain concepts
Blockchain conceptsBlockchain concepts
Blockchain concepts
 
DevOps continuous learning and experimentation
DevOps continuous learning and experimentationDevOps continuous learning and experimentation
DevOps continuous learning and experimentation
 
DevOps ci/cd with Microsoft vsts and azure
DevOps ci/cd with Microsoft vsts and azureDevOps ci/cd with Microsoft vsts and azure
DevOps ci/cd with Microsoft vsts and azure
 
DevOps the phoenix project simulation
DevOps the phoenix project simulationDevOps the phoenix project simulation
DevOps the phoenix project simulation
 
Dev ops culture and principles of high performing organization
Dev ops culture and principles of high performing organizationDev ops culture and principles of high performing organization
Dev ops culture and principles of high performing organization
 
DevOps culture in high performing organization and adoption & growth of DevOps
DevOps culture in high performing organization and adoption & growth of DevOps DevOps culture in high performing organization and adoption & growth of DevOps
DevOps culture in high performing organization and adoption & growth of DevOps
 
Zero downtime release through DevOps Continuous Delivery
Zero downtime release through DevOps Continuous DeliveryZero downtime release through DevOps Continuous Delivery
Zero downtime release through DevOps Continuous Delivery
 
DevOps game marshmallow challenge
DevOps game marshmallow challengeDevOps game marshmallow challenge
DevOps game marshmallow challenge
 
DevOps game lego
DevOps game legoDevOps game lego
DevOps game lego
 
Top 10 devops values
Top 10 devops valuesTop 10 devops values
Top 10 devops values
 

Recently uploaded

Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 

Recently uploaded (20)

Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 

Git version control and trunk based approach with VSTS

  • 1. Git Version Control and Trunk based with VSTS Murughan Palaniachari
  • 2. Murughan Palaniachari Principal Consultant – DevOps and Blockchain Organizer of Cloud and DevOps meetup Technical Agility Conference http://aidevdays.com/ http://www.containerconf.in/ https://elevate-org.com/ https://devopsgames.com/ https://in.linkedin.com/in/murughan @Murughan_P With my Guru – John Willis & Jez Humble
  • 4. What is Visual Studio Team Services? • It’s a source control system! • Wrong. It is FAR more than a source control system. • Everything you need to create software. From application inception to application sun setting. • DevOps Collaboration Hub • Key Functional Areas • Agile Planning & Management/Work Item Tracking • Version Control • Build Management & Automation • Testing • Release Management • Application Monitoring @Murughan_P
  • 5. REQUIREMENTS Plan Develop + Test Release Business Product Owners Developers Testers Operations + all other Stakeholders Backlog Enabling Value Delivery @Murughan_P
  • 6. Agenda – Version Control • Version Control Overview • Centralized Version Control • Distributed Version Control • Git Overview • Pre-requisites • Git Installation • Git Commands • Branching, Merging, Rebase • Trunk based approach • Pull request • Code review • Workshop with sample Python Application @Murughan_P
  • 7. Training Exercises • Exercise 1: Practise Git commands – command line • Exercise 2: Create Git repository in VSTS, clone it, git commands through Visual Studio • Exercise 3: Trunk based approach, create branch, create pull request and approve. • Exercise 4: Unit testing with Unittest python for sample Phonebook app • Exercise 5: Mock data with Unittest Mock package python for sample bank accounts app • Exercise 6: TDD for sample Calculator app • Demo: UI Testing with Selenium Web Driver python @Murughan_P
  • 9. Version Control • Version Control as Fundamental Enabler of Continuous Delivery • One single source of truth for everything • Manage your daily tasks • Create • Save • Edit • Save again • Collaborative History tracking • What changes • Why was things changed – comments • Compare the changes • Who has made change https://git-scm.com/ @Murughan_P
  • 11. Git - Distributed Version Control • Git is a fast and modern implementation of Version Control • Git is a fast, scalable, distributed revision control system with an unusually rich command set that provides both high-level operations and full access to internals. • Git provides a history of content changes • Git facilitates Collaborative Changes to files • East to use for anyone and any knowledge worker • Local Git • Easy to learn https://git-scm.com/ @Murughan_P
  • 12. Git - Distributed Version Control https://app.pluralsight.com/library/courses/tfs-visual-studio-2015-implementing-continuous-delivery/table-of-contents @Murughan_P
  • 13. Principle - Keep everything in Source Control https://www.edx.org/course/introduction-devops-transforming-linuxfoundationx-lfs161x @Murughan_P
  • 14. Git Installation • Windows • https://git-scm.com/downloads • Mac OSX • https://git-scm.com/download/mac • Linux • https://git- scm.com/download/linux @Murughan_P
  • 15. The Three States committed, modified, and staged • Committed means that the data is safely stored in your local database. • Modified means that you have changed the file but have not committed it to your database yet. • Staged means that you have marked a modified file in its current version to go into your next commit snapshot. https://git-scm.com/book/en/v2/Getting-Started-Git-Basics @Murughan_P
  • 16. Exercise 1 Practise Git commands – command line @Murughan_P
  • 17. Git commands list • git • git --version • Prints the Git suite version that the git program came from. • git --help • Prints the synopsis and a list of the most commonly used commands. Ex: git --help merge https://git-scm.com/docs/git @Murughan_P
  • 18. Configuring Git Git comes with a tool called git config that lets you get and set configuration variables that control all aspects of how Git looks and operates. • System-level configuration • git config --system • Stored in /etc/gitconfig or c:Program Files (x86)Gitetcgitconfig • User-level configuration • git config --global • Stored in ~/.gitconfig or c:Users<NAME>.gitconfig @Murughan_P
  • 19. Configuring Git • Repository-level configuration • git config • Stored in .git/config in each repo • Set Identity • git config --global user.name "John Doe" • git config --global user.email johndoe@example.com • Check your seetings • git config --list @Murughan_P
  • 20. Git commands • Creating a local repository • git init sampleproject • cd sampleproject • Open this folder in editor and add some test files • Adding files • git add . • Committing changes – local commit • git commit -m "Creating sample project“ • Cloning app • Git clone https://github.com/murughan1985/pythonSample.git @Murughan_P
  • 21. STAGE & SNAPSHOT Working with snapshots and the Git staging area • git add [file] • add a file as it looks now to your next commit (stage) • git status • show modified files in working directory, staged for your next commit • git reset [file] • unstage a file while retaining the changes in working directory • git diff //modify the test file • - diff of what is changed but not staged • git diff –staged • diff of what is staged but not yet commited • git commit -m “[descriptive message]” • commit your staged content as a new commit snapshot @Murughan_P
  • 22. Log @Murughan_P • show the commit history for the currently active branchgit log • show the commits on branchA that are not on branchBgit log branchB..branchA • show the commits that changed file, even across renamesgit log --follow [file] • show the diff of what is in branchA that is not in branchBgit diff branchB...branchA • show any object in Git in human-readable formatgit show [SHA]
  • 23. Exercise 2 Create Git repository in VSTS, clone it, git commands through Visual Studio @Murughan_P
  • 24. VSTS – Git tab • Repository • Create New Repository • Import New repository • Manage Repository • Clone and Fork • Files • Content • History • Commits • Pushes • Tags https://www.youtube.com/watch?v=ykZbBD-CmP8 @Murughan_P
  • 25. Github – Create python Django project from visual studio and push it to github Workshop Check out my blogpost on this https://elevate-org.com/2018/05/13/create-python-django-project-from-visual-studio-and- push-it-to-github/ @Murughan_P
  • 26. SHARE & UPDATE @Murughan_P • add a git URL as an aliasgit remote add [alias] [url] • fetch down all the branches from that Git remotegit fetch [alias] • merge a remote branch into your current branch to bring it up to dategit merge [alias]/[branch] • Transmit local branch commits to the remote repository branchgit push [alias] [branch] • fetch and merge any commits from the tracking remote branchgit pull
  • 27. TRACKING PATH CHANGES @Murughan_P • delete the file from project and stage the removal for commitgit rm [file] • change an existing file path and stage the move git mv [existing-path] [new-path] • show all commit logs with indication of any paths that movedgit log --stat -M
  • 28. Git commands • Branch • git branch feature1 • Merge changes to master • git merge sampleproject • Rebase - you can take all the changes that were committed on one branch and replay them on another one. • git checkout fature1 • git rebase master • Stage - Add file contents to the staging area • git stage @Murughan_P
  • 29. Create VSTS project and Git repository. Workshop Check out my blogpost on this https://elevate- org.com/2018/05/13/configure-git- version-control-in-vsts-and-create-push- python-django-project-through-visual- studio/ @Murughan_P
  • 30. Branching and Merging • Branching means you diverge from the main line of development and continue to do work without messing with that main line. • The way Git branches is incredibly lightweight, making branching operations nearly instantaneous, and switching back and forth between branches generally just as fast. • Below command create branch called feature1 from master • git branch feature1 • Merging Join two or more development histories together • git merge feature1 • Staging Add file contents to the staging area @Murughan_P
  • 33. Trunk based approach • A source-control branching model, where developers collaborate on code in a single branch called ‘trunk’. • Resist any pressure to create other long-lived development branches by employing documented techniques. • They therefore avoid merge hell, do not break the build, and live happily ever after. @Murughan_Phttps://trunkbaseddevelopment.com/
  • 37. BRANCH & MERGE Isolating work in branches, changing context, and integrating changes • git branch • list your branches. a * will appear next to the currently active branch • git branch [branch-name] • create a new branch at the current commit • git checkout • switch to another branch and check it out into your working directory • git merge [branch] • merge the specified branch’s history into the current one • git log • show all commits in the current branch’s history @Murughan_P
  • 38. Pull request • The pull request is the collaborative process that lets the rest of the team discuss changes in a branch and agree to merge them once everyone approves. Use pull requests to get early feedback from others on work in progress, even if you're not ready to merge the changes into another branch. • In this image, the purple branch is merged into the blue branch through a pull request. The changes are discussed by reviewers in the pull request before the code is merged. When you complete the pull request, there is a merge commit (seen here as the filled blue commit) where the changes in the purple branch are now merged in the blue branch. @Murughan_P
  • 39. Exercise 3 Trunk based approach, create branch, create pull request and approve with VSTS and Visual Studio @Murughan_P
  • 40. VSTS – Branches, Pull request • Branches • New Branch • Branch Policy • Pull request • Create • Approve • Modify code @Murughan_P
  • 41. Reference/Further reading • https://git-scm.com/docs/git • https://trunkbaseddevelopment.com/ • https://continuousdelivery.com/ • https://app.pluralsight.com/library/courses/tfs-visual-studio-2015-implementing- continuous-delivery/table-of-contents • https://elevate-org.com