SlideShare uma empresa Scribd logo
1 de 40
Baixar para ler offline
Introducing : git + gitflow
Sebin Benjamin,
Software Engineer
Lulu International Exchange
What is git ?
Git is an open source, distributed version control system designed for speed and
efficiency.
● Every developer “clones” a copy of a repository and has the full history of the
project on their own hard drive. This copy (or “clone”) has all of the metadata
of the original.
● Enables you to track changes, when they happened, and who made them.
● Revert to different versions if needed
● Develop in parallel using branches
● Easier to collaborate with other developers
What is git ?
● Git creates a .git folder (in the current folder) to store the details of the file
system - this folder contains all the data required to track your files and is
known as a repository, or repo.
● Git has got branches which allow you to work on a copy of the code without
destroying the original.
Centralized VCS
Distributed VCS
https://try.github.io
● Working tree
● Staging area
● Git directory
Sections of a Git project
http://rogerdudler.github.io
/git-guide/
Commits, the basic building blocks
● Code is wrapped into commits
● One thing added per commit
● Commits should have useful names
● git log lists the commits made in that repository in reverse chronological order
● lists each commit with its (40 char) SHA-1 checksum, the author’s name and
email, the date written, and the commit message
$ git log
commit ca82a6dff817ec66f44342007202690a93763949
Author: Scott Chacon <schacon@gee-mail.com>
Date: Mon Mar 17 21:52:11 2008 -0700
changed the version number
commit 085bb3bcb608e1e8451d4b2432f8ecbe6306e7e7
Author: Scott Chacon <schacon@gee-mail.com>
Date: Sat Mar 15 16:40:33 2008 -0700
removed unnecessary test
commit a11bef06a3f659402fe7563abf99ad00de2209e6
Author: Scott Chacon <schacon@gee-mail.com>
Date: Sat Mar 15 10:31:28 2008 -0700
first commit
Commit messages
Should be detailed and be descriptive and follow a format.
● Write commit messages as a sentence
● Make sure one commit does just one thing
● Capitalize sentences.
Use either:
● Present tense of the commit does
● A description of what the changes in the code does
● Example : fix off by one error in the Bar loop
Tags
● Tags are pointers to a commit of particular significance. Some examples of
these are for marking versions of your product or important changes.
● Right click on the commit you'd like to tag, and select create tag here at the
bottom.
● Tags are similar to branches, but tags are static pointers to a particular
commit, whereas when you add a new commit to a branch, the head of the
branch moves to point to the new commit.
● If you would want to make the tag available on a remote, just right click the tag
and select to push the tag to the remote.
Branches
● Branching means you diverge from the main line of development and
continue to do work without messing with that main line
● Git branches is incredibly lightweight, making branching operations nearly
instantaneous, and switching back and forth between branches generally just
as fast
Merging
● Merging takes the commits on two different branches and combines them.
● Files are automatically merged, unless their are two conflicting set of changes
(merge conflicts) , i.e. commits on the different branches updating the same
line in different ways.
https://git-scm.com/book/en/v2/Git-Branching-Branches-in-a-Nutshell
https://support.gitkraken.com/repositories/local
.gitignore
● From time to time, there are files/folders you don't want Git to check in to git
repository.
● A .gitignore file should be committed into your repository to share the ignore
rules with any other users that clone the repository.
● Example:
sebin@home:~$ cat .gitignore
# Build Files #
bin
target
build/
.gradle https://github.com/github/gitignore
https://git-scm.com/docs/gitignore
Command line instructions - cloning
Git global setup
git config --global user.name "Jenkins"
git config --global user.email "jenkins@devops.com"
Cloning a new repository
git clone http://jenkins@172.30.13.20:8025/utility-apps/remind-me.git
cd remind-me
touch README.md
git add README.md
git commit -m "add README"
git push -u origin master
Adding existing folder to new repository
cd existing_folder
git init
git remote add origin http://jenkins@172.30.13.20:8025/utility-apps/remind-me.git
git add .
git commit
git push -u origin master
Pushing an existing Git repository
cd existing_repo
git remote add origin http://jenkins@172.30.13.20:8025/utility-apps/remind-me.git
git push -u origin --all
git push -u origin --tags
git clients
Users can manage Git primarily from
the command line, however, there
are several graphical user interface
(GUI) Git clients that facilitate
efficient and reliable usage of Git on
a desktop and offer most, if not all of
the command line operations.
- Gitkraken
- Source Tree
gitflow
- a branching model for Git...
GitFlow is a list of rules to keep a
repo’s history organized, and is
used to make the release process,
bug fixes, and feature creation
easier.
http://nvie.com/img/git-model@2x.png
The main branches
● master
○ origin/master to be the main branch where the source code of HEAD always
reflects a production-ready state
● develop
○ origin/develop to be the main branch where the source code of HEAD always
reflects a state with the latest delivered development changes for the next
release. Some would call this the “integration branch”.
Supporting branches
A variety of supporting branches aid parallel development between team members,
ease tracking of features, prepare for production releases and to assist in quickly
fixing live production problems.
These branches always have a limited lifetime, since they will be removed
eventually.
Branches are not “special” from a technical perspective. The branch types are
categorized by how we use them. They are of course plain old Git branches.
The different types of branches we may use are:
● Feature branches
● Release branches
● Hotfix branches
● May branch off from:
develop
● Must merge back into:
develop
● Branch naming convention:
anything except master, develop, release-*, or hotfix-*
● Feature branches (or sometimes called topic branches) are used to develop
new features for the upcoming or a distant future release.
Feature branches
● Exists as long as the feature is in development, but will
eventually be merged back into develop (to definitely
add the new feature to the upcoming release) or
discarded (in case of a disappointing experiment).
Feature branches
Release branches
● May branch off from:
develop
● Must merge back into:
develop and master
● Branch naming convention:
release-*
● Support preparation of a new production release.
● Allows for last-minute dotting of i’s and crossing t’s.
● Allow for minor bug fixes and preparing metadata for a release (version
number, build dates, etc.).
● develop branch is cleared to receive features for the next big release, once
the release branch is created
● At least all features that are targeted for the release-to-be-built must be
merged into develop at this point in time.
● All features targeted at future releases may not—they must wait until after the
release branch is branched off.
● When the state of the release branch is ready to become a real release,
release branch is merged into master and develop
● Commit on master must be tagged for easy future reference to this historical
version
Hotfix branches
● May branch off from:
master
● Must merge back into:
develop and master
● Branch naming convention:
hotfix-*
Hotfix branches are very much like release
branches in that they are also meant to prepare
for a new production release, albeit unplanned.
Hotfix branches
● When a critical bug in a production version
must be resolved immediately, a hotfix
branch may be branched off from the
corresponding tag on the master branch that
marks the production version.
● Team members (on the develop branch) can
continue, while another person is preparing a
quick production fix.
● Exception to the rule here is that, when a
release branch currently exists, the hotfix
changes need to be merged into that
release branch, instead of develop.
Git client support
● Gitkraken -
https://support.gitkraken.com/repositories/git-flow
● Added benefit of adding all features, hotfixes, and
release branches in different folders.
● Prefix for the GitFlow branch type will allow gui to
recognize it as being a GitFlow branch, i.e.
feature/branch-name. Any branches that do not
have the prefix, will be displayed in the local
repository section, but not in the GitFlow menu.
If you do not currently have these branches in your local repository, GitKraken
will create them when GitFlow is initialized.
Color Conventions - Gitkraken
Red - File deleted
Green - File added (new file)
Orange - File modified
Branch naming conventions
● Use dashes (-) to separate parts of your branch names
● Do not use bare numbers as leading parts. Eg: 5450124-bug-remit
● Avoid long descriptive names. Eg: avoid remit-temporary-fix-for-live-important
● Avoid use of capital letters
● Identifiers from corresponding tickets in an external service (eg. a GitHub
issue) are also good candidates for use in branch names. Eg : bug ID’s in yodiz
or other issue reporting tools
https://github.com/agis/git-style-guide
References
● “How GitHub will save the World Economy” - Scott Chacon
https://github.com/schacon/git-presentations/tree/master/git_world_economy_talk
● An Introduction to Collaborating with Version Control
https://learn.adafruit.com/an-introduction-to-collaborating-with-version-control/overview
● Git book
https://git-scm.com/book/en/v2/
● Ignoring files - Github help
https://help.github.com/articles/ignoring-files/
● A successful Git branching model
http://nvie.com/posts/a-successful-git-branching-model/
● GitFlow in Gitkraken
https://support.gitkraken.com/repositories/git-flow
Thank you

Mais conteúdo relacionado

Mais procurados

Getting started With GIT
Getting started With GITGetting started With GIT
Getting started With GITGhadiAlGhosh
 
News from Git in Eclipse - EclipseCon EU - 2016-10-26
News from Git in Eclipse - EclipseCon EU - 2016-10-26News from Git in Eclipse - EclipseCon EU - 2016-10-26
News from Git in Eclipse - EclipseCon EU - 2016-10-26msohn
 
Github 101 An Adventurer's Guide To Open Source
Github 101   An Adventurer's Guide To Open SourceGithub 101   An Adventurer's Guide To Open Source
Github 101 An Adventurer's Guide To Open SourcePrachitibhukan
 
Git and github fundamentals
Git and github fundamentalsGit and github fundamentals
Git and github fundamentalsRajKharvar
 
Github Case Study By Amil Ali
Github Case Study By Amil AliGithub Case Study By Amil Ali
Github Case Study By Amil AliAmilAli1
 
Helios in Action: Git at Eclipse
Helios in Action: Git at EclipseHelios in Action: Git at Eclipse
Helios in Action: Git at EclipseChris Aniszczyk
 
Introduction to git and Github
Introduction to git and GithubIntroduction to git and Github
Introduction to git and GithubWycliff1
 
Brush up on using github
Brush up on using githubBrush up on using github
Brush up on using githubSebin Benjamin
 
Introduction to Git and Github
Introduction to Git and Github Introduction to Git and Github
Introduction to Git and Github Max Claus Nunes
 
Git strategies for DevOps
Git strategies for DevOpsGit strategies for DevOps
Git strategies for DevOpsAhmad Iqbal Ali
 
Intro to git and git hub
Intro to git and git hubIntro to git and git hub
Intro to git and git hubJasleenSondhi
 

Mais procurados (20)

Getting started With GIT
Getting started With GITGetting started With GIT
Getting started With GIT
 
News from Git in Eclipse - EclipseCon EU - 2016-10-26
News from Git in Eclipse - EclipseCon EU - 2016-10-26News from Git in Eclipse - EclipseCon EU - 2016-10-26
News from Git in Eclipse - EclipseCon EU - 2016-10-26
 
Github 101 An Adventurer's Guide To Open Source
Github 101   An Adventurer's Guide To Open SourceGithub 101   An Adventurer's Guide To Open Source
Github 101 An Adventurer's Guide To Open Source
 
Git and github fundamentals
Git and github fundamentalsGit and github fundamentals
Git and github fundamentals
 
Github Case Study By Amil Ali
Github Case Study By Amil AliGithub Case Study By Amil Ali
Github Case Study By Amil Ali
 
Helios in Action: Git at Eclipse
Helios in Action: Git at EclipseHelios in Action: Git at Eclipse
Helios in Action: Git at Eclipse
 
Intro to Git & GitHub
Intro to Git & GitHubIntro to Git & GitHub
Intro to Git & GitHub
 
Git in Eclipse
Git in EclipseGit in Eclipse
Git in Eclipse
 
Open source
Open sourceOpen source
Open source
 
Github
GithubGithub
Github
 
Introduction to git and Github
Introduction to git and GithubIntroduction to git and Github
Introduction to git and Github
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
Brush up on using github
Brush up on using githubBrush up on using github
Brush up on using github
 
Git Introduction
Git IntroductionGit Introduction
Git Introduction
 
Introduction to Git and Github
Introduction to Git and Github Introduction to Git and Github
Introduction to Git and Github
 
Git strategies for DevOps
Git strategies for DevOpsGit strategies for DevOps
Git strategies for DevOps
 
Intro to git and git hub
Intro to git and git hubIntro to git and git hub
Intro to git and git hub
 
Git hub visualstudiocode
Git hub visualstudiocodeGit hub visualstudiocode
Git hub visualstudiocode
 
Version control
Version controlVersion control
Version control
 
Git
GitGit
Git
 

Semelhante a Introducing Git and git flow

Git for developers
Git for developersGit for developers
Git for developersHacen Dadda
 
Git and GitHub workflows
Git and GitHub workflowsGit and GitHub workflows
Git and GitHub workflowsArthur Shvetsov
 
Git flow Introduction
Git flow IntroductionGit flow Introduction
Git flow IntroductionDavid Paluy
 
Git usage (Basics and workflow)
Git usage (Basics and workflow)Git usage (Basics and workflow)
Git usage (Basics and workflow)Yeasin Abedin
 
Git 101: Force-sensitive to Jedi padawan
Git 101: Force-sensitive to Jedi padawanGit 101: Force-sensitive to Jedi padawan
Git 101: Force-sensitive to Jedi padawanJames Ford
 
Git tutorial
Git tutorialGit tutorial
Git tutorialmobaires
 
Git basics a starter on git and its ecosystem
Git basics  a starter on git and its ecosystemGit basics  a starter on git and its ecosystem
Git basics a starter on git and its ecosystemFrançois D'Agostini
 
Git from the trenches
Git from the trenchesGit from the trenches
Git from the trenchesNuno Caneco
 
Git essential training & sharing self
Git essential training & sharing selfGit essential training & sharing self
Git essential training & sharing selfChen-Tien Tsai
 
Git and git workflow best practice
Git and git workflow best practiceGit and git workflow best practice
Git and git workflow best practiceMajid Hosseini
 
Version control and GIT Primer
Version control and GIT PrimerVersion control and GIT Primer
Version control and GIT Primersaadulde
 
Vincit Teatime 2015.2 - Otto Kekäläinen: Don't be a git
Vincit Teatime 2015.2 - Otto Kekäläinen: Don't be a gitVincit Teatime 2015.2 - Otto Kekäläinen: Don't be a git
Vincit Teatime 2015.2 - Otto Kekäläinen: Don't be a gitVincitOy
 
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 DeveloperJohn Stevenson
 

Semelhante a Introducing Git and git flow (20)

Git for developers
Git for developersGit for developers
Git for developers
 
Git and GitHub workflows
Git and GitHub workflowsGit and GitHub workflows
Git and GitHub workflows
 
Git flow Introduction
Git flow IntroductionGit flow Introduction
Git flow Introduction
 
Git usage (Basics and workflow)
Git usage (Basics and workflow)Git usage (Basics and workflow)
Git usage (Basics and workflow)
 
Git 101: Force-sensitive to Jedi padawan
Git 101: Force-sensitive to Jedi padawanGit 101: Force-sensitive to Jedi padawan
Git 101: Force-sensitive to Jedi padawan
 
Git tutorial
Git tutorialGit tutorial
Git tutorial
 
Git basics a starter on git and its ecosystem
Git basics  a starter on git and its ecosystemGit basics  a starter on git and its ecosystem
Git basics a starter on git and its ecosystem
 
Git Basics
Git BasicsGit Basics
Git Basics
 
Formation git
Formation gitFormation git
Formation git
 
Git
GitGit
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 from the trenches
Git from the trenchesGit from the trenches
Git from the trenches
 
GIT_Overview.
GIT_Overview.GIT_Overview.
GIT_Overview.
 
Git essential training & sharing self
Git essential training & sharing selfGit essential training & sharing self
Git essential training & sharing self
 
Git and git workflow best practice
Git and git workflow best practiceGit and git workflow best practice
Git and git workflow best practice
 
Version control and GIT Primer
Version control and GIT PrimerVersion control and GIT Primer
Version control and GIT Primer
 
Git introduction
Git introductionGit introduction
Git introduction
 
Git essentials
Git essentialsGit essentials
Git essentials
 
Vincit Teatime 2015.2 - Otto Kekäläinen: Don't be a git
Vincit Teatime 2015.2 - Otto Kekäläinen: Don't be a gitVincit Teatime 2015.2 - Otto Kekäläinen: Don't be a git
Vincit Teatime 2015.2 - Otto Kekäläinen: Don't be a git
 
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
 

Último

WSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024VictoriaMetrics
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park masabamasaba
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareJim McKeeth
 
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...WSO2
 
+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
 
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...WSO2
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...Shane Coughlan
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrainmasabamasaba
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
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
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastPapp Krisztián
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...masabamasaba
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...masabamasaba
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyviewmasabamasaba
 
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 SaaSWSO2
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2
 
%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 kaalfonteinmasabamasaba
 
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2
 

Último (20)

WSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - Keynote
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
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...
 
+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...
 
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...
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
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...
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
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
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 
%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
 
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
 

Introducing Git and git flow

  • 1. Introducing : git + gitflow Sebin Benjamin, Software Engineer Lulu International Exchange
  • 2. What is git ? Git is an open source, distributed version control system designed for speed and efficiency. ● Every developer “clones” a copy of a repository and has the full history of the project on their own hard drive. This copy (or “clone”) has all of the metadata of the original. ● Enables you to track changes, when they happened, and who made them. ● Revert to different versions if needed ● Develop in parallel using branches ● Easier to collaborate with other developers
  • 3. What is git ? ● Git creates a .git folder (in the current folder) to store the details of the file system - this folder contains all the data required to track your files and is known as a repository, or repo. ● Git has got branches which allow you to work on a copy of the code without destroying the original.
  • 5.
  • 7.
  • 9. ● Working tree ● Staging area ● Git directory Sections of a Git project
  • 11. Commits, the basic building blocks ● Code is wrapped into commits ● One thing added per commit ● Commits should have useful names ● git log lists the commits made in that repository in reverse chronological order ● lists each commit with its (40 char) SHA-1 checksum, the author’s name and email, the date written, and the commit message
  • 12. $ git log commit ca82a6dff817ec66f44342007202690a93763949 Author: Scott Chacon <schacon@gee-mail.com> Date: Mon Mar 17 21:52:11 2008 -0700 changed the version number commit 085bb3bcb608e1e8451d4b2432f8ecbe6306e7e7 Author: Scott Chacon <schacon@gee-mail.com> Date: Sat Mar 15 16:40:33 2008 -0700 removed unnecessary test commit a11bef06a3f659402fe7563abf99ad00de2209e6 Author: Scott Chacon <schacon@gee-mail.com> Date: Sat Mar 15 10:31:28 2008 -0700 first commit
  • 13.
  • 14. Commit messages Should be detailed and be descriptive and follow a format. ● Write commit messages as a sentence ● Make sure one commit does just one thing ● Capitalize sentences. Use either: ● Present tense of the commit does ● A description of what the changes in the code does ● Example : fix off by one error in the Bar loop
  • 15. Tags ● Tags are pointers to a commit of particular significance. Some examples of these are for marking versions of your product or important changes. ● Right click on the commit you'd like to tag, and select create tag here at the bottom. ● Tags are similar to branches, but tags are static pointers to a particular commit, whereas when you add a new commit to a branch, the head of the branch moves to point to the new commit. ● If you would want to make the tag available on a remote, just right click the tag and select to push the tag to the remote.
  • 16. Branches ● Branching means you diverge from the main line of development and continue to do work without messing with that main line ● Git branches is incredibly lightweight, making branching operations nearly instantaneous, and switching back and forth between branches generally just as fast Merging ● Merging takes the commits on two different branches and combines them. ● Files are automatically merged, unless their are two conflicting set of changes (merge conflicts) , i.e. commits on the different branches updating the same line in different ways. https://git-scm.com/book/en/v2/Git-Branching-Branches-in-a-Nutshell
  • 18. .gitignore ● From time to time, there are files/folders you don't want Git to check in to git repository. ● A .gitignore file should be committed into your repository to share the ignore rules with any other users that clone the repository. ● Example: sebin@home:~$ cat .gitignore # Build Files # bin target build/ .gradle https://github.com/github/gitignore https://git-scm.com/docs/gitignore
  • 19. Command line instructions - cloning Git global setup git config --global user.name "Jenkins" git config --global user.email "jenkins@devops.com" Cloning a new repository git clone http://jenkins@172.30.13.20:8025/utility-apps/remind-me.git cd remind-me touch README.md git add README.md git commit -m "add README" git push -u origin master
  • 20. Adding existing folder to new repository cd existing_folder git init git remote add origin http://jenkins@172.30.13.20:8025/utility-apps/remind-me.git git add . git commit git push -u origin master Pushing an existing Git repository cd existing_repo git remote add origin http://jenkins@172.30.13.20:8025/utility-apps/remind-me.git git push -u origin --all git push -u origin --tags
  • 21. git clients Users can manage Git primarily from the command line, however, there are several graphical user interface (GUI) Git clients that facilitate efficient and reliable usage of Git on a desktop and offer most, if not all of the command line operations. - Gitkraken - Source Tree
  • 22. gitflow - a branching model for Git... GitFlow is a list of rules to keep a repo’s history organized, and is used to make the release process, bug fixes, and feature creation easier.
  • 24. The main branches ● master ○ origin/master to be the main branch where the source code of HEAD always reflects a production-ready state ● develop ○ origin/develop to be the main branch where the source code of HEAD always reflects a state with the latest delivered development changes for the next release. Some would call this the “integration branch”.
  • 25.
  • 26. Supporting branches A variety of supporting branches aid parallel development between team members, ease tracking of features, prepare for production releases and to assist in quickly fixing live production problems. These branches always have a limited lifetime, since they will be removed eventually. Branches are not “special” from a technical perspective. The branch types are categorized by how we use them. They are of course plain old Git branches. The different types of branches we may use are: ● Feature branches ● Release branches ● Hotfix branches
  • 27. ● May branch off from: develop ● Must merge back into: develop ● Branch naming convention: anything except master, develop, release-*, or hotfix-* ● Feature branches (or sometimes called topic branches) are used to develop new features for the upcoming or a distant future release. Feature branches
  • 28. ● Exists as long as the feature is in development, but will eventually be merged back into develop (to definitely add the new feature to the upcoming release) or discarded (in case of a disappointing experiment). Feature branches
  • 29. Release branches ● May branch off from: develop ● Must merge back into: develop and master ● Branch naming convention: release-* ● Support preparation of a new production release. ● Allows for last-minute dotting of i’s and crossing t’s. ● Allow for minor bug fixes and preparing metadata for a release (version number, build dates, etc.).
  • 30. ● develop branch is cleared to receive features for the next big release, once the release branch is created ● At least all features that are targeted for the release-to-be-built must be merged into develop at this point in time. ● All features targeted at future releases may not—they must wait until after the release branch is branched off. ● When the state of the release branch is ready to become a real release, release branch is merged into master and develop ● Commit on master must be tagged for easy future reference to this historical version
  • 31. Hotfix branches ● May branch off from: master ● Must merge back into: develop and master ● Branch naming convention: hotfix-* Hotfix branches are very much like release branches in that they are also meant to prepare for a new production release, albeit unplanned.
  • 32. Hotfix branches ● When a critical bug in a production version must be resolved immediately, a hotfix branch may be branched off from the corresponding tag on the master branch that marks the production version. ● Team members (on the develop branch) can continue, while another person is preparing a quick production fix. ● Exception to the rule here is that, when a release branch currently exists, the hotfix changes need to be merged into that release branch, instead of develop.
  • 33. Git client support ● Gitkraken - https://support.gitkraken.com/repositories/git-flow ● Added benefit of adding all features, hotfixes, and release branches in different folders. ● Prefix for the GitFlow branch type will allow gui to recognize it as being a GitFlow branch, i.e. feature/branch-name. Any branches that do not have the prefix, will be displayed in the local repository section, but not in the GitFlow menu.
  • 34.
  • 35. If you do not currently have these branches in your local repository, GitKraken will create them when GitFlow is initialized.
  • 36.
  • 37. Color Conventions - Gitkraken Red - File deleted Green - File added (new file) Orange - File modified
  • 38. Branch naming conventions ● Use dashes (-) to separate parts of your branch names ● Do not use bare numbers as leading parts. Eg: 5450124-bug-remit ● Avoid long descriptive names. Eg: avoid remit-temporary-fix-for-live-important ● Avoid use of capital letters ● Identifiers from corresponding tickets in an external service (eg. a GitHub issue) are also good candidates for use in branch names. Eg : bug ID’s in yodiz or other issue reporting tools https://github.com/agis/git-style-guide
  • 39. References ● “How GitHub will save the World Economy” - Scott Chacon https://github.com/schacon/git-presentations/tree/master/git_world_economy_talk ● An Introduction to Collaborating with Version Control https://learn.adafruit.com/an-introduction-to-collaborating-with-version-control/overview ● Git book https://git-scm.com/book/en/v2/ ● Ignoring files - Github help https://help.github.com/articles/ignoring-files/ ● A successful Git branching model http://nvie.com/posts/a-successful-git-branching-model/ ● GitFlow in Gitkraken https://support.gitkraken.com/repositories/git-flow