SlideShare a Scribd company logo
1 of 88
Download to read offline
Managing
E-commerce systems
codebase with Git
Bruno Ricardo Siqueira
About me
Bruno Ricardo Siqueira
Brazilian, working as Senior Software
Developer at Smartbox, ~10 years of
software development experience, PHP
evangelist, Git lover, Rock N' Roll fan,
Sci-fi addicted, MTG hobbyist player.
brunoric.info
linkedin.com/in/brunoric
twitter.com/brunoric
github.com/brunoric
● Motivation
○ Why your E-commerce system need a VCS?
○ Why Git?
● Git flows
○ Why use or create a flow?
○ Centralized workflow
○ Feature branch workflow
○ Gitflow workflow
○ Forking workflow
○ Dictator and lieutenants workflow
● Git features and tools
Agenda
Managing E-commerce systems codebase with Git
Motivation
Motivation
Why your E-commerce
system need a VCS?
Motivation - Why your E-commerce system need a VCS?
Long-term change history
of every file
Motivation - Why your E-commerce system need a VCS?
Traceability
Motivation - Why your E-commerce system need a VCS?
Branching and merging
Motivation - Why your E-commerce system need a VCS?
Motivation - Why your E-commerce system need a VCS?
Conflict resolution
Motivation - Why your E-commerce system need a VCS?
● Improve automation for daily tasks
● Avoid code loss
● Backup and restore strategy
● Prototyping
● Find when a specific bug or feature was introduced
● …
● Continuous integration and Continuous delivery
Motivation
Why Git?
Motivation - Why Git?
“I'm an egotistical bastard, and I
name all my projects after
myself. First Linux, now git.”
- Linus Torvalds
Motivation - Why Git?
Motivation - Why Git?
Motivation - Why Git?
Managing E-commerce systems codebase with Git
Git Flows
Git Flows
Why use or create a flow?
Git Flows - Why use or create a flow?
● With Git, branching and merging is cheap
● Flows bring history consistency
● Provide a logical way of reading the history
● Facilitate automation
● Facilitate new joiners ramp up
● Avoid mistakes (unintended pushes, merges, unmerged branches, etc)
● ...
Git Flows
Centralized workflow
Git Flows - Centralized workflow
● Like Subversion with
benefits:
○ developers have their
own local repository
○ Git branches are
fail-safe
○ Merge process is
painless
Git Flows - Centralized workflow
Git Flows - Centralized workflow
git push origin master
Git Flows - Centralized workflow
Git Flows - Centralized workflow
git push origin master
Git Flows - Centralized workflow
git push origin master
Git Flows - Centralized workflow
error: failed to push some refs to '/path/to/repo.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
hint: before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.git push origin master
Git Flows - Centralized workflow
git pull --rebase origin master
Git Flows - Centralized workflow
Git Flows - Centralized workflow
git add <some-file>
git rebase --continue
git push origin master
Git Flows
Feature branch workflow
Git Flows - Feature branch workflow
Git Flows - Feature branch workflow
Git Flows - Feature branch workflow
Git Flows - Feature branch workflow
Git Flows - Feature branch workflow
Git Flows - Feature branch workflow
Git Flows - Feature branch workflow
Git Flows
Gitflow workflow
Git Flows - Gitflow workflow
Git Flows - Gitflow workflow
Git Flows - Gitflow workflow
Git Flows - Gitflow workflow
Git Flows - Gitflow workflow
Git Flows - Gitflow workflow
git clone ssh://user@host/path/to/repo.git
git checkout -b develop origin/develop
git checkout -b some-feature develop
git status
git add <some-file>
git commit
Git Flows - Gitflow workflow
git pull origin develop
git checkout develop
git merge some-feature
git push
git branch -d some-feature
Git Flows - Gitflow workflow
git checkout -b release-0.1 develop
Git Flows - Gitflow workflow
git checkout master
git merge release-0.1
git push
git checkout develop
git merge release-0.1
git push
git branch -d release-0.1
Git Flows - Gitflow workflow
git checkout master
git merge release-0.1
git push
git checkout develop
git merge release-0.1
git push
git branch -d release-0.1
Git Flows
Forking workflow
Git Flows - Forking workflow
Git Flows - Forking workflow
Git Flows - Forking workflow
Git Flows - Forking workflow
Git Flows - Forking workflow
Git Flows - Forking workflow
Git Flows - Forking workflow
Git Flows - Forking workflow
Git Flows - Forking workflow
Git Flows
Dictator and lieutenants
workflow
Git Flows - Dictator and lieutenants workflow
Managing E-commerce systems codebase with Git
Git features and tools
Git features and tools
git log
git log [<options>] [<revision range>] [[--] <path>…​]
Git features and tools - git log
Git features and tools - git log
Git features and tools - git log
Git features and tools
git cherry-pick [--edit] [-n] [-m parent-number] [-s] [-x] [--ff]
[-S[<keyid>]] <commit>…​
git cherry-pick --continue
git cherry-pick --quit
git cherry-pick --abort
git cherry-pick
Git features and tools - git cherry-pick
Git features and tools
git cherry-pick [--edit] [-n] [-m parent-number] [-s] [-x] [--ff]
[-S[<keyid>]] <commit>…​
git cherry-pick --continue
git cherry-pick --quit
git cherry-pick --abort
git stash
Git features and tools - git stash
Git features and tools - git stash
Git features and tools - git stash
git stash
git checkout another-branch
phpunit
… # do some changes ...
git stash [pop/apply]
… # do another changes ...
phpunit
… # fix test issues
git add -p
… # do more fixes
git add .
Git features and tools
git bisect <subcommand> <options>
git bisect
Git features and tools - git bisect
git bisect start
git checkout BAD-POINT
git bisect bad
git checkout GOOD-POINT
git bisect good
Git features and tools - git bisect
Git features and tools
What else?
Git features and tools - What else?
git revert [--[no-]edit] [-n] [-m parent-number] [-s] [-S[<keyid>]] <commit>…​
git revert --continue
git revert --quit
git revert --abort
git revert
Git features and tools - What else?
git apply [--stat] [--numstat] [--summary] [--check] [--index] [--3way]
[--apply] [--no-add] [--build-fake-ancestor=<file>] [-R | --reverse]
[--allow-binary-replacement | --binary] [--reject] [-z]
[-p<n>] [-C<n>] [--inaccurate-eof] [--recount] [--cached]
[--ignore-space-change | --ignore-whitespace]
[--whitespace=(nowarn|warn|fix|error|error-all)]
[--exclude=<path>] [--include=<path>] [--directory=<root>]
[--verbose] [--unsafe-paths] [<patch>…​]
git apply
Git features and tools - What else?
git hooks
Git features and tools - What else?
Managing E-commerce systems codebase with Git
Credits and reference
Git Flows - Credits and reference
● Tutorials, documentation and other presentations:
○ A successful Git branching model - Vincent Driessen:
http://nvie.com/posts/a-successful-git-branching-model
○ Atlassian Advanced Git Tutorials:
https://www.atlassian.com/git/tutorials/advanced-overview
○ Git - Distributed Workflows:
https://git-scm.com/book/it/v2/Distributed-Git-Distributed-Workflows
○ Git - Get Ready To Use It
http://www.slideshare.net/origamiaddict/git-get-ready-to-use-it
○ Git Tower:
https://www.git-tower.com/learn/git/ebook/en/command-line/appendix
/from-subversion-to-git
Git Flows - Credits and reference
● Flow images:
○ Atlassian: https://www.atlassian.com/git/tutorials
○ Git SCM: https://git-scm.com/book
● Linus Torvalds image:
http://news.softpedia.com/news/Linus-Torvalds-presents-a-new-software-ma
nagement-configuration-system-1421.shtml
● Git bisect images:
http://five.agency/cut-your-way-through-problems-with-git-bisect
https://www.effectiveperlprogramming.com/wp-content/uploads/bisect1.png
● Git stash GIF:
http://thecodinglove.com/post/151285532543/git-stash
● Git hook image:
http://www.slideshare.net/PolishedGeek/git-hooked-using-git-hooks-to-impro
ve-your-software-development-process
Managing E-commerce systems codebase with Git
Thanks!

More Related Content

What's hot

Git Introduction
Git IntroductionGit Introduction
Git Introduction
Gareth Hall
 
2015-ghci-presentation-git_gerritJenkins_final
2015-ghci-presentation-git_gerritJenkins_final2015-ghci-presentation-git_gerritJenkins_final
2015-ghci-presentation-git_gerritJenkins_final
Mythri P K
 

What's hot (20)

Git Merge, Resets and Branches
Git Merge, Resets and BranchesGit Merge, Resets and Branches
Git Merge, Resets and Branches
 
Git introduction for Beginners
Git introduction for BeginnersGit introduction for Beginners
Git introduction for Beginners
 
Git Flow - An Introduction
Git Flow - An IntroductionGit Flow - An Introduction
Git Flow - An Introduction
 
Git Tricks — git utilities that make life git easier
Git Tricks — git utilities that make life git easierGit Tricks — git utilities that make life git easier
Git Tricks — git utilities that make life git easier
 
Git like a Pro (How to use it as it was meant to)
Git like a Pro (How to use it as it was meant to)Git like a Pro (How to use it as it was meant to)
Git like a Pro (How to use it as it was meant to)
 
Git for Beginners
Git for BeginnersGit for Beginners
Git for Beginners
 
Getting Started with Git
Getting Started with GitGetting Started with Git
Getting Started with Git
 
Git & Github
Git & GithubGit & Github
Git & Github
 
Git 101
Git 101Git 101
Git 101
 
Git flow Introduction
Git flow IntroductionGit flow Introduction
Git flow Introduction
 
Git Introduction
Git IntroductionGit Introduction
Git Introduction
 
Git'in in 15
Git'in in 15Git'in in 15
Git'in in 15
 
Git'in on Windows
Git'in on WindowsGit'in on Windows
Git'in on Windows
 
Open Innovation Lab (OIL) - 20150227 - GIT Intro Workshop
Open Innovation Lab (OIL) - 20150227 - GIT Intro WorkshopOpen Innovation Lab (OIL) - 20150227 - GIT Intro Workshop
Open Innovation Lab (OIL) - 20150227 - GIT Intro Workshop
 
2015-ghci-presentation-git_gerritJenkins_final
2015-ghci-presentation-git_gerritJenkins_final2015-ghci-presentation-git_gerritJenkins_final
2015-ghci-presentation-git_gerritJenkins_final
 
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 Series. Episode 3. Git Flow and Github-Flow
Git Series. Episode 3. Git Flow and Github-FlowGit Series. Episode 3. Git Flow and Github-Flow
Git Series. Episode 3. Git Flow and Github-Flow
 
Git collaboration
Git collaborationGit collaboration
Git collaboration
 
Git Flow and JavaScript Coding Style
Git Flow and JavaScript Coding StyleGit Flow and JavaScript Coding Style
Git Flow and JavaScript Coding Style
 
Git n git hub
Git n git hubGit n git hub
Git n git hub
 

Viewers also liked (8)

Vijay_Karthik
Vijay_KarthikVijay_Karthik
Vijay_Karthik
 
Diagnóstico de problemas de hardware más comunes
Diagnóstico de problemas de hardware más comunesDiagnóstico de problemas de hardware más comunes
Diagnóstico de problemas de hardware más comunes
 
Mm. alimentos entre parientes
Mm. alimentos entre parientesMm. alimentos entre parientes
Mm. alimentos entre parientes
 
13.08.2010, NEWSWIRE, Issue 131
13.08.2010, NEWSWIRE, Issue 13113.08.2010, NEWSWIRE, Issue 131
13.08.2010, NEWSWIRE, Issue 131
 
Infoscan kinderen en jongeren_uitforum2015
Infoscan kinderen en jongeren_uitforum2015Infoscan kinderen en jongeren_uitforum2015
Infoscan kinderen en jongeren_uitforum2015
 
Vocab tattoos (global)
Vocab tattoos (global)Vocab tattoos (global)
Vocab tattoos (global)
 
Cyberbullying
CyberbullyingCyberbullying
Cyberbullying
 
Survey Project Submission
Survey Project SubmissionSurvey Project Submission
Survey Project Submission
 

Similar to Managing e commerce systems codebase with git

3 Git
3 Git3 Git
Version control git day03(amarnath dada)
Version control   git day03(amarnath dada)Version control   git day03(amarnath dada)
Version control git day03(amarnath dada)
Gourav Varma
 
Version control git day03
Version control   git day03Version control   git day03
Version control git day03
Gourav Varma
 

Similar to Managing e commerce systems codebase with git (20)

Pro git - grasping it conceptually
Pro git - grasping it conceptuallyPro git - grasping it conceptually
Pro git - grasping it conceptually
 
Version control git day02
Version control   git day02Version control   git day02
Version control git day02
 
GIT from n00b
GIT from n00bGIT from n00b
GIT from n00b
 
Introduction into Git
Introduction into GitIntroduction into Git
Introduction into Git
 
Lets git to it
Lets git to itLets git to it
Lets git to it
 
Git - An Introduction
Git - An IntroductionGit - An Introduction
Git - An Introduction
 
Git
GitGit
Git
 
Git introduction
Git introductionGit introduction
Git introduction
 
Bedjango talk about Git & GitHub
Bedjango talk about Git & GitHubBedjango talk about Git & GitHub
Bedjango talk about Git & GitHub
 
Github By Nyros Developer
Github By Nyros DeveloperGithub By Nyros Developer
Github By Nyros Developer
 
3 Git
3 Git3 Git
3 Git
 
Git: Git'ing the Basic
Git: Git'ing the BasicGit: Git'ing the Basic
Git: Git'ing the Basic
 
Git and github - Verson Control for the Modern Developer
Git and github - Verson Control for the Modern DeveloperGit and github - Verson Control for the Modern Developer
Git and github - Verson Control for the Modern Developer
 
Improving your workflow with git
Improving your workflow with gitImproving your workflow with git
Improving your workflow with git
 
Version control git day03(amarnath dada)
Version control   git day03(amarnath dada)Version control   git day03(amarnath dada)
Version control git day03(amarnath dada)
 
Version control git day03
Version control   git day03Version control   git day03
Version control git day03
 
Git Ninja KT (GitHub to GitLab)
Git Ninja KT (GitHub to GitLab)Git Ninja KT (GitHub to GitLab)
Git Ninja KT (GitHub to GitLab)
 
git Technologies
git Technologiesgit Technologies
git Technologies
 
Introduction to git & github
Introduction to git & githubIntroduction to git & github
Introduction to git & github
 
Wokshop de Git
Wokshop de Git Wokshop de Git
Wokshop de Git
 

More from Bruno Ricardo Siqueira

More from Bruno Ricardo Siqueira (6)

Construindo aplicações CLI com Symfony Console
Construindo aplicações CLI com Symfony ConsoleConstruindo aplicações CLI com Symfony Console
Construindo aplicações CLI com Symfony Console
 
TDC SP 2015 - PHP7: better & faster
TDC SP 2015 - PHP7: better & fasterTDC SP 2015 - PHP7: better & faster
TDC SP 2015 - PHP7: better & faster
 
TDC SP 2015 - PHP7: melhor e mais rápido
TDC SP 2015 - PHP7: melhor e mais rápidoTDC SP 2015 - PHP7: melhor e mais rápido
TDC SP 2015 - PHP7: melhor e mais rápido
 
Fluxo de desenvolvimento de software utilizando Git
Fluxo de desenvolvimento de software utilizando GitFluxo de desenvolvimento de software utilizando Git
Fluxo de desenvolvimento de software utilizando Git
 
Impulsionando sua presença Online
Impulsionando sua presença OnlineImpulsionando sua presença Online
Impulsionando sua presença Online
 
Desenvolvendo e implantando aplicações PHP utilizando Docker
Desenvolvendo e implantando aplicações PHP utilizando DockerDesenvolvendo e implantando aplicações PHP utilizando Docker
Desenvolvendo e implantando aplicações PHP utilizando Docker
 

Recently uploaded

%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
masabamasaba
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
chiefasafspells
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
masabamasaba
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
masabamasaba
 

Recently uploaded (20)

WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
 
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open SourceWSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
WSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaSWSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaS
 

Managing e commerce systems codebase with git

  • 1. Managing E-commerce systems codebase with Git Bruno Ricardo Siqueira
  • 2. About me Bruno Ricardo Siqueira Brazilian, working as Senior Software Developer at Smartbox, ~10 years of software development experience, PHP evangelist, Git lover, Rock N' Roll fan, Sci-fi addicted, MTG hobbyist player. brunoric.info linkedin.com/in/brunoric twitter.com/brunoric github.com/brunoric
  • 3. ● Motivation ○ Why your E-commerce system need a VCS? ○ Why Git? ● Git flows ○ Why use or create a flow? ○ Centralized workflow ○ Feature branch workflow ○ Gitflow workflow ○ Forking workflow ○ Dictator and lieutenants workflow ● Git features and tools Agenda
  • 4. Managing E-commerce systems codebase with Git Motivation
  • 6.
  • 7. Motivation - Why your E-commerce system need a VCS? Long-term change history of every file
  • 8.
  • 9. Motivation - Why your E-commerce system need a VCS? Traceability
  • 10.
  • 11. Motivation - Why your E-commerce system need a VCS? Branching and merging
  • 12. Motivation - Why your E-commerce system need a VCS?
  • 13. Motivation - Why your E-commerce system need a VCS? Conflict resolution
  • 14.
  • 15. Motivation - Why your E-commerce system need a VCS? ● Improve automation for daily tasks ● Avoid code loss ● Backup and restore strategy ● Prototyping ● Find when a specific bug or feature was introduced ● … ● Continuous integration and Continuous delivery
  • 17. Motivation - Why Git? “I'm an egotistical bastard, and I name all my projects after myself. First Linux, now git.” - Linus Torvalds
  • 21. Managing E-commerce systems codebase with Git Git Flows
  • 22. Git Flows Why use or create a flow?
  • 23. Git Flows - Why use or create a flow? ● With Git, branching and merging is cheap ● Flows bring history consistency ● Provide a logical way of reading the history ● Facilitate automation ● Facilitate new joiners ramp up ● Avoid mistakes (unintended pushes, merges, unmerged branches, etc) ● ...
  • 25. Git Flows - Centralized workflow ● Like Subversion with benefits: ○ developers have their own local repository ○ Git branches are fail-safe ○ Merge process is painless
  • 26. Git Flows - Centralized workflow
  • 27. Git Flows - Centralized workflow git push origin master
  • 28. Git Flows - Centralized workflow
  • 29. Git Flows - Centralized workflow git push origin master
  • 30. Git Flows - Centralized workflow git push origin master
  • 31. Git Flows - Centralized workflow error: failed to push some refs to '/path/to/repo.git' hint: Updates were rejected because the tip of your current branch is behind hint: its remote counterpart. Merge the remote changes (e.g. 'git pull') hint: before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details.git push origin master
  • 32. Git Flows - Centralized workflow git pull --rebase origin master
  • 33. Git Flows - Centralized workflow
  • 34. Git Flows - Centralized workflow git add <some-file> git rebase --continue git push origin master
  • 36. Git Flows - Feature branch workflow
  • 37. Git Flows - Feature branch workflow
  • 38. Git Flows - Feature branch workflow
  • 39. Git Flows - Feature branch workflow
  • 40. Git Flows - Feature branch workflow
  • 41. Git Flows - Feature branch workflow
  • 42. Git Flows - Feature branch workflow
  • 44. Git Flows - Gitflow workflow
  • 45. Git Flows - Gitflow workflow
  • 46. Git Flows - Gitflow workflow
  • 47. Git Flows - Gitflow workflow
  • 48. Git Flows - Gitflow workflow
  • 49. Git Flows - Gitflow workflow git clone ssh://user@host/path/to/repo.git git checkout -b develop origin/develop git checkout -b some-feature develop git status git add <some-file> git commit
  • 50. Git Flows - Gitflow workflow git pull origin develop git checkout develop git merge some-feature git push git branch -d some-feature
  • 51. Git Flows - Gitflow workflow git checkout -b release-0.1 develop
  • 52. Git Flows - Gitflow workflow git checkout master git merge release-0.1 git push git checkout develop git merge release-0.1 git push git branch -d release-0.1
  • 53. Git Flows - Gitflow workflow git checkout master git merge release-0.1 git push git checkout develop git merge release-0.1 git push git branch -d release-0.1
  • 55. Git Flows - Forking workflow
  • 56. Git Flows - Forking workflow
  • 57. Git Flows - Forking workflow
  • 58. Git Flows - Forking workflow
  • 59. Git Flows - Forking workflow
  • 60. Git Flows - Forking workflow
  • 61. Git Flows - Forking workflow
  • 62. Git Flows - Forking workflow
  • 63. Git Flows - Forking workflow
  • 64. Git Flows Dictator and lieutenants workflow
  • 65. Git Flows - Dictator and lieutenants workflow
  • 66. Managing E-commerce systems codebase with Git Git features and tools
  • 67. Git features and tools git log git log [<options>] [<revision range>] [[--] <path>…​]
  • 68. Git features and tools - git log
  • 69. Git features and tools - git log
  • 70. Git features and tools - git log
  • 71. Git features and tools git cherry-pick [--edit] [-n] [-m parent-number] [-s] [-x] [--ff] [-S[<keyid>]] <commit>…​ git cherry-pick --continue git cherry-pick --quit git cherry-pick --abort git cherry-pick
  • 72. Git features and tools - git cherry-pick
  • 73. Git features and tools git cherry-pick [--edit] [-n] [-m parent-number] [-s] [-x] [--ff] [-S[<keyid>]] <commit>…​ git cherry-pick --continue git cherry-pick --quit git cherry-pick --abort git stash
  • 74. Git features and tools - git stash
  • 75. Git features and tools - git stash
  • 76. Git features and tools - git stash git stash git checkout another-branch phpunit … # do some changes ... git stash [pop/apply] … # do another changes ... phpunit … # fix test issues git add -p … # do more fixes git add .
  • 77. Git features and tools git bisect <subcommand> <options> git bisect
  • 78. Git features and tools - git bisect git bisect start git checkout BAD-POINT git bisect bad git checkout GOOD-POINT git bisect good
  • 79. Git features and tools - git bisect
  • 80. Git features and tools What else?
  • 81. Git features and tools - What else? git revert [--[no-]edit] [-n] [-m parent-number] [-s] [-S[<keyid>]] <commit>…​ git revert --continue git revert --quit git revert --abort git revert
  • 82. Git features and tools - What else? git apply [--stat] [--numstat] [--summary] [--check] [--index] [--3way] [--apply] [--no-add] [--build-fake-ancestor=<file>] [-R | --reverse] [--allow-binary-replacement | --binary] [--reject] [-z] [-p<n>] [-C<n>] [--inaccurate-eof] [--recount] [--cached] [--ignore-space-change | --ignore-whitespace] [--whitespace=(nowarn|warn|fix|error|error-all)] [--exclude=<path>] [--include=<path>] [--directory=<root>] [--verbose] [--unsafe-paths] [<patch>…​] git apply
  • 83. Git features and tools - What else? git hooks
  • 84. Git features and tools - What else?
  • 85. Managing E-commerce systems codebase with Git Credits and reference
  • 86. Git Flows - Credits and reference ● Tutorials, documentation and other presentations: ○ A successful Git branching model - Vincent Driessen: http://nvie.com/posts/a-successful-git-branching-model ○ Atlassian Advanced Git Tutorials: https://www.atlassian.com/git/tutorials/advanced-overview ○ Git - Distributed Workflows: https://git-scm.com/book/it/v2/Distributed-Git-Distributed-Workflows ○ Git - Get Ready To Use It http://www.slideshare.net/origamiaddict/git-get-ready-to-use-it ○ Git Tower: https://www.git-tower.com/learn/git/ebook/en/command-line/appendix /from-subversion-to-git
  • 87. Git Flows - Credits and reference ● Flow images: ○ Atlassian: https://www.atlassian.com/git/tutorials ○ Git SCM: https://git-scm.com/book ● Linus Torvalds image: http://news.softpedia.com/news/Linus-Torvalds-presents-a-new-software-ma nagement-configuration-system-1421.shtml ● Git bisect images: http://five.agency/cut-your-way-through-problems-with-git-bisect https://www.effectiveperlprogramming.com/wp-content/uploads/bisect1.png ● Git stash GIF: http://thecodinglove.com/post/151285532543/git-stash ● Git hook image: http://www.slideshare.net/PolishedGeek/git-hooked-using-git-hooks-to-impro ve-your-software-development-process
  • 88. Managing E-commerce systems codebase with Git Thanks!

Editor's Notes

  1. Version control without a version control system.
  2. Changes made by many individuals over development process. Creation and deletion of files. File changes. Different VCS tools differ on how well they handle the history. Usually includes the author, date and written notes. If the software is being actively worked on, almost everything can be considered an "older version" of the software.
  3. You can find when and who introduced any change. This is important to know more about the context of the code change.
  4. Branching and merging possibilities parallel work in an organized way. Different people can work in the same codebase supported by tools that will help you in reusing the code for another purpose (branching) and insert back you modifications (merging).
  5. A very important part is conflict resolution. With different people working in the same codebase, conflicts will happen for sure. You need tooling for solve this problem in an efficient way.
  6. Deploy. Code loss by moving files or wrongly merging changes. You can easily make changes in your system. Having the complete history enables going back to previous versions to help in root cause analysis for bugs and it is crucial when needing to fix problems in older versions of software. CI and CD.
  7. Git development began in April 2005, after many developers of the Linux Kernel gave up access to BitKeeper. The legend says that Linus Torvalds started the development in a weekend and in the same weekend Git was already using itself as version control system. Junio C Hamano is the current lead of Git project.
  8. Fast. Decentralized. Open-source. Huge user-base. Community oriented (Github, Gitlab, Bitbucket, etc). Extensible.
  9. Unlike SVN, git provides the full repository locally instead of just a working copy.
  10. Git staging area is an important concept. You work on your local repository, do your changes, stage them (git add), commit them (git commit) and publish them (git push).
  11. First, it gives every developer their own local copy of the entire project. Unlike SVN, Git branches are designed to be a fail-safe mechanism for integrating code and sharing changes between repositories.
  12. With this flow the goal is to have a linear history as much as possible.
  13. John pushes his code to master.
  14. But again, unlike Subversion, Git gives you the flexibility to branch out locally, as many as you want.
  15. Mary also tries to push her changes.
  16. The push is rejected.
  17. Mary needs to update her local branch.
  18. Mary pulls the remote changes. In Git, pull is an alias to git fetch and git merge, but with the --rebase option it's a git fetch and git rebase.
  19. With the rebase operation, the changes made by Mary will be applied on top of John's code.
  20. If the code has any conflicts those need to be solved and staged before continuing the rebase process. Everything is done locally, so to publish your changes you will need to push them.
  21. Let's use Git as it was designed to be used, with decentralized contribution.
  22. Branch out for a new feature.
  23. Do implementations.
  24. Finish implementations.
  25. Push feature.
  26. Feature is added to the main branch.
  27. Pull latest changes from main repository.
  28. Gitflow is a workflow proposed by Vincent Driessen in 2010. He was working at the time for nvie (now GitPrime), and they were using Gitflow as a branching model for internal projects. Gitflow is a strict framework for branching and merging using the concepts of the Feature workflow as base.
  29. Historical Branches: Instead of a single master branch, this workflow uses two branches to record the history of the project. The master branch stores the official release history, and the develop branch serves as an integration branch for features. It's also convenient to tag all commits in the master branch with a version number.
  30. Features branches: Each new feature should reside in its own branch, which can be pushed to the central repository for backup/collaboration. But, instead of branching off of master, feature branches use develop as their parent branch. When a feature is complete, it gets merged back into develop. Features should never interact directly with master.
  31. Release branches: Once develop has acquired enough features for a release, you branch out a release from develop. Creating this branch starts the next release cycle, so no new features can be added after this point - only bug fixes. Once it's ready to ship, the release gets merged into master and tagged with a version number. In addition, it should be merged back into develop, which may have progressed since the release was initiated.
  32. Maintenance Branches: Maintenance or “hotfix” branches are used to quickly patch production releases. This is the only branch that should fork directly off of master. As soon as the fix is complete, it should be merged into both master and develop (or the current release branch), and master should be tagged with an updated version number.
  33. Instead of using a single server-side repository to act as the “central” codebase, it gives every developer a server-side repository. This means that each contributor has not one, but two Git repositories: a private local one and a public server-side one. Very distributed!
  34. As with any Git-based project, the first step is to create an official repository on a server accessible to all of the team members. Typically, this repository will also serve as the public repository of the project maintainer.
  35. Next, all of the other developers need to fork this official repository. It’s possible to do this by SSH’ing into the server and running git clone to copy it to another location on the server—yes, forking is basically just a server-side clone.
  36. Next each developer needs to clone their own public repository. They can do with the familiar git clone command. And also add the first created repo as the official upstream.
  37. Developers do their local changes.
  38. Developers publish their changes.
  39. After publishing their changes, developers create pull requests and the project maintainer(s) analyse them.
  40. With new pull requests accepted, developers needs to pull from the upstream.
  41. Also called as Integration-Manager Workflow.
  42. Used by Linux Kernel project. Various integration managers are in charge of certain parts of the repository; they’re called lieutenants. All the lieutenants have one integration manager known as the benevolent dictator. The benevolent dictator’s repository serves as the reference repository from which all the collaborators need to pull.
  43. Binary search. Logarithmic complexity.