SlideShare a Scribd company logo
1 of 29
Collaboration with Git
& Bitbucket
Pikicast R&D
Jack Pham
Pull Request and
Code Review
Anatomy of a Pull Request
source repo
target repo
source branch
target branch
Reviewers
Reviewers
Merge
pull request
Pull request process
A developer creates the feature in a
dedicated branch in their local repo. feature
The developer pushes the branch to a
public Bitbucket repository.
local repo
public repo
push
feature
The developer files a pull request via
Bitbucket.
file a pull request
feature
master
master
Reviewers
The rest of the team reviews the code,
discusses it, and updates it.
The project maintainer merges the feature
into the official repository and closes the
pull request. public repo
Workflows with Git
feature
master
feature
Centralized Workflow Feature Branch Workflow
Gitflow Workflow Forking Workflow
Centralized Workflow
Working Workflow
- Everybody working on the same
branch$ git pull # Update latest code
# Edit files
$ git add <file> # Stage file
$ git commit # Commit change
$ git push # Push to remote repo
pull
pull
push
origin/master
origin/master
push
Cannot push because
the base has changed
origin/master
master
pull
merge
rebase +
fast-forward merge
origin/master
master
origin/master
master
push
When to use
- Everybody working on the
same branch
- Simple flow
- No review or feature
request allowed
- More conflict if many devs
+Easy to manage
+Good for less prone to
change project
+Good for maintaining
project
Infra Team ?
Feature Branch
Workflow
feature
master
feature
Feature Branch Workflow
- There are:
- One master branch
- Many feature branches (each for a feature)
- Each feature is developed on a dedicate branch
- A pull request is filed when feature is completed
- Feature branch is closed (delete) after finish
feature
master
feature
Working on crazy_feature
# Implement the feature
$ git add <file> # Stage file
$ git commit # Commit change
$ git pull # Update latest code
$ git checkout -b crazy_feature
$ git push -u origin # optional
master
feature
master
feature
master
crazy_feature
Local Remote
crazy_feature
master
crazy_feature
master
crazy_feature
master
1.0
crazy_feature
master
1.0
$ git push # Push to remote repo
Finalise crazy_feature
# Implement the feature
$ git add <file> # Stage file
$ git commit # Commit change
$ git push # Push to remote repo
feature
master
feature
Remote
crazy_feature
master
crazy_feature
master
Local
hotfix or
other feature
crazy_feature
master
hotfix or
other feature
Reviewers
master
master
Merge
Rebase
When to use
feature
master
feature
- Dirty master branch
- Develop vs. Production
- Feature vs. Hotfix
- NO Release tracking
+Relatively easy to manage
+Code review support
+Good for internal project
(no hand off release to
end-users)
Simple team structure, focus
task, few concurrent task
Git-flow Workflow
- There are:
- One master branch
- One develop branch
- One temporary branch for each release
- One feature branch for each feature
- One temporary hotfix branch for each hot fix
Git-flow Workflow anatomy
Development
semantic versioning
Release
Feature Branch Workflow
Gitflow conventions
- Master branch tracks release
- Develop branch tracks feature/issue development
- Hot-fix branches are always branched off master
branch
- Feature/issue branches are always branched off
develop branch
- Release branches are always branched off develop
branch
Branching
Git-flow conventions
- Feature branches are always be merged to only
develop branch after finish
- Hot-fix and Release branches need to be merged to
both master and develop branch after finish
- Only hot-fix and Release are allowed to merge to
Master branch
Merging
Gitflow conventions
- Feature branches should be named: feature/<name>
- ex: feature/walkthrough
- Hot fix branches should be named: hotfix/<name>
- ex: hotfix/reallyhotfix
- Only hot-fix and Release are allowed to merge to Master
branch
- ex: release/v1.0
Naming
Gitflow Tools (Source Tree)
When to use
- Many branch
- Need follow convention to
have smooth
management
+Separate release and
development
+Multi-thread
+Prevent dirty branch history
+Good for end user product
with release base
Big team, multiple group and
concurrent feature, and regularly
release
Forking Workflow
Forking Workflow
Official CloneClone Official CloneClone
Team1 Team2 Team3
Forking Workflow
Centralize
Feature Branch
Git-flow
- Each clone repo can be a
central repo of a group
- Each may organised as
other work flow
When to use
- More than one central
repo
- Huge and distributed
- Large scale project
Open source project
Reference
• Reading
• https://www.atlassian.com/git/tutorials
• https://git-scm.com/book/en/v2
• https://www.youtube.com/watch?v=OMLh-5O6Ub8
• Git hosting with pull-request
• Bitbucket, Github, gitLab…many more

More Related Content

What's hot

Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Simplilearn
 

What's hot (20)

Git and GitHub | Concept about Git and GitHub Process | Git Process overview
Git and GitHub | Concept about Git and GitHub Process | Git Process overviewGit and GitHub | Concept about Git and GitHub Process | Git Process overview
Git and GitHub | Concept about Git and GitHub Process | Git Process overview
 
DevOps with GitHub Actions
DevOps with GitHub ActionsDevOps with GitHub Actions
DevOps with GitHub Actions
 
Github
GithubGithub
Github
 
Basic Git Intro
Basic Git IntroBasic Git Intro
Basic Git Intro
 
Gitlab flow solo
Gitlab flow soloGitlab flow solo
Gitlab flow solo
 
Git and git workflow best practice
Git and git workflow best practiceGit and git workflow best practice
Git and git workflow best practice
 
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 flow Introduction
Git flow IntroductionGit flow Introduction
Git flow Introduction
 
Introduction to GitHub Actions
Introduction to GitHub ActionsIntroduction to GitHub Actions
Introduction to GitHub Actions
 
Git One Day Training Notes
Git One Day Training NotesGit One Day Training Notes
Git One Day Training Notes
 
git and github
git and githubgit and github
git and github
 
Github - Git Training Slides: Foundations
Github - Git Training Slides: FoundationsGithub - Git Training Slides: Foundations
Github - Git Training Slides: Foundations
 
Git and Github slides.pdf
Git and Github slides.pdfGit and Github slides.pdf
Git and Github slides.pdf
 
Starting with Git & GitHub
Starting with Git & GitHubStarting with Git & GitHub
Starting with Git & GitHub
 
Introducing GitLab (September 2018)
Introducing GitLab (September 2018)Introducing GitLab (September 2018)
Introducing GitLab (September 2018)
 
The everyday developer's guide to version control with Git
The everyday developer's guide to version control with GitThe everyday developer's guide to version control with Git
The everyday developer's guide to version control with Git
 
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
 
Overview of github
Overview of githubOverview of github
Overview of github
 
Introduction to Git Commands and Concepts
Introduction to Git Commands and ConceptsIntroduction to Git Commands and Concepts
Introduction to Git Commands and Concepts
 
Git 101 for Beginners
Git 101 for Beginners Git 101 for Beginners
Git 101 for Beginners
 

Similar to Git collaboration

A successful Git branching model
A successful Git branching model A successful Git branching model
A successful Git branching model
abodeltae
 

Similar to Git collaboration (20)

git Technologies
git Technologiesgit Technologies
git Technologies
 
Collaborative development with git
Collaborative development with gitCollaborative development with git
Collaborative development with git
 
Git Workflows
Git WorkflowsGit Workflows
Git Workflows
 
Git development workflow
Git development workflowGit development workflow
Git development workflow
 
How to use Git Branch
How to use Git BranchHow to use Git Branch
How to use Git Branch
 
Flow
FlowFlow
Flow
 
A successful Git branching model
A successful Git branching model A successful Git branching model
A successful Git branching model
 
Git and Git Workflow Models as Catalysts of Software Development
Git and Git Workflow Models as Catalysts of Software DevelopmentGit and Git Workflow Models as Catalysts of Software Development
Git and Git Workflow Models as Catalysts of Software Development
 
Switching to Git
Switching to GitSwitching to Git
Switching to Git
 
Git
GitGit
Git
 
01 - Git vs SVN
01 - Git vs SVN01 - Git vs SVN
01 - Git vs SVN
 
Git
GitGit
Git
 
CS_Note_Introduction to Git Workflow.pdf
CS_Note_Introduction to Git Workflow.pdfCS_Note_Introduction to Git Workflow.pdf
CS_Note_Introduction to Git Workflow.pdf
 
Git more done
Git more doneGit more done
Git more done
 
Git-flow workflow and pull-requests
Git-flow workflow and pull-requestsGit-flow workflow and pull-requests
Git-flow workflow and pull-requests
 
Git basics, Team Workflows (Ciro Miranda)
Git basics, Team Workflows (Ciro Miranda)Git basics, Team Workflows (Ciro Miranda)
Git basics, Team Workflows (Ciro Miranda)
 
Introducing Git and git flow
Introducing Git and git flow Introducing Git and git flow
Introducing Git and git flow
 
How We Use GitHub
How We Use GitHubHow We Use GitHub
How We Use GitHub
 
Gitflow Workflow
Gitflow WorkflowGitflow Workflow
Gitflow Workflow
 
Gitflow - Branching and Merging Flow for Git
Gitflow - Branching and Merging Flow for GitGitflow - Branching and Merging Flow for Git
Gitflow - Branching and Merging Flow for Git
 

Recently uploaded

introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
VishalKumarJha10
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 

Recently uploaded (20)

Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
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
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 

Git collaboration

  • 1. Collaboration with Git & Bitbucket Pikicast R&D Jack Pham
  • 3. Anatomy of a Pull Request source repo target repo source branch target branch Reviewers Reviewers Merge pull request
  • 4. Pull request process A developer creates the feature in a dedicated branch in their local repo. feature The developer pushes the branch to a public Bitbucket repository. local repo public repo push feature The developer files a pull request via Bitbucket. file a pull request feature master master Reviewers The rest of the team reviews the code, discusses it, and updates it. The project maintainer merges the feature into the official repository and closes the pull request. public repo
  • 5.
  • 6.
  • 8. feature master feature Centralized Workflow Feature Branch Workflow Gitflow Workflow Forking Workflow
  • 10. Working Workflow - Everybody working on the same branch$ git pull # Update latest code # Edit files $ git add <file> # Stage file $ git commit # Commit change $ git push # Push to remote repo pull pull push origin/master origin/master push Cannot push because the base has changed origin/master master pull merge rebase + fast-forward merge origin/master master origin/master master push
  • 11. When to use - Everybody working on the same branch - Simple flow - No review or feature request allowed - More conflict if many devs +Easy to manage +Good for less prone to change project +Good for maintaining project Infra Team ?
  • 13. Feature Branch Workflow - There are: - One master branch - Many feature branches (each for a feature) - Each feature is developed on a dedicate branch - A pull request is filed when feature is completed - Feature branch is closed (delete) after finish feature master feature
  • 14. Working on crazy_feature # Implement the feature $ git add <file> # Stage file $ git commit # Commit change $ git pull # Update latest code $ git checkout -b crazy_feature $ git push -u origin # optional master feature master feature master crazy_feature Local Remote crazy_feature master crazy_feature master crazy_feature master 1.0 crazy_feature master 1.0 $ git push # Push to remote repo
  • 15. Finalise crazy_feature # Implement the feature $ git add <file> # Stage file $ git commit # Commit change $ git push # Push to remote repo feature master feature Remote crazy_feature master crazy_feature master Local hotfix or other feature crazy_feature master hotfix or other feature Reviewers master master Merge Rebase
  • 16. When to use feature master feature - Dirty master branch - Develop vs. Production - Feature vs. Hotfix - NO Release tracking +Relatively easy to manage +Code review support +Good for internal project (no hand off release to end-users) Simple team structure, focus task, few concurrent task
  • 18. - There are: - One master branch - One develop branch - One temporary branch for each release - One feature branch for each feature - One temporary hotfix branch for each hot fix Git-flow Workflow anatomy
  • 20. Gitflow conventions - Master branch tracks release - Develop branch tracks feature/issue development - Hot-fix branches are always branched off master branch - Feature/issue branches are always branched off develop branch - Release branches are always branched off develop branch Branching
  • 21. Git-flow conventions - Feature branches are always be merged to only develop branch after finish - Hot-fix and Release branches need to be merged to both master and develop branch after finish - Only hot-fix and Release are allowed to merge to Master branch Merging
  • 22. Gitflow conventions - Feature branches should be named: feature/<name> - ex: feature/walkthrough - Hot fix branches should be named: hotfix/<name> - ex: hotfix/reallyhotfix - Only hot-fix and Release are allowed to merge to Master branch - ex: release/v1.0 Naming
  • 24. When to use - Many branch - Need follow convention to have smooth management +Separate release and development +Multi-thread +Prevent dirty branch history +Good for end user product with release base Big team, multiple group and concurrent feature, and regularly release
  • 26. Forking Workflow Official CloneClone Official CloneClone Team1 Team2 Team3
  • 27. Forking Workflow Centralize Feature Branch Git-flow - Each clone repo can be a central repo of a group - Each may organised as other work flow
  • 28. When to use - More than one central repo - Huge and distributed - Large scale project Open source project
  • 29. Reference • Reading • https://www.atlassian.com/git/tutorials • https://git-scm.com/book/en/v2 • https://www.youtube.com/watch?v=OMLh-5O6Ub8 • Git hosting with pull-request • Bitbucket, Github, gitLab…many more

Editor's Notes

  1. A developer creates the feature in a dedicated branch in their local repo. The developer pushes the branch to a public Bitbucket repository. The developer files a pull request via Bitbucket. The rest of the team reviews the code, discusses it, and alters it. The project maintainer merges the feature into the official repository and closes the pull request.
  2. suite for infra team, setting file, configuration file, less likely to change.
  3. For feature, merge are recommend because of the history clearly show which commit belong to the feature development.
  4. No need to freeze code for release