SlideShare a Scribd company logo
Pull Requests: Do’s &
Don’ts
Arie Bregman
Senior Software Engineer @RedHat
Agenda
● Terminology
● Do’s and Don’ts
● Projects guidelines and templates
● Open Discussion
● Questions
Commit
● A record of your changes
● Adding your changes to the
tree of the repository
Pull Request
● A request to submit code
● Pull request can include several
commits
● Different systems use different
approach for code reviews
○ Gerrit
● Why knowing how to submit pull
requests is important?
Reviewer
● A person who goes over your changes, comment about them and vote
accordingly
● Reviewer can be anyone
○ Technical or Non-technical
○ Someone from your team or external
○ Junior or Senior
CI
● What is CI? We need a separate session for this
● Trying to describe the most common workflow would be:
○ An automated process for easily and safely testing your pull request with latest revision of
your project
● CI can includes stages like compiling, testing, installing and configuring the
project
● Popular CI systems
○ Jenkins
○ Travis
Don’t: Meaningless commit messages
● Why this is bad?
○ Reviewer doesn’t know what your code suppose to do
○ In the future, people will not be able to understand why a certain change was done when
running for example ‘git log’
Do: Meaningful commit messages
Don’t: include multiple commits in a single PR
Don’t: include multiple commits in a single PR
● Why this is bad?
○ You are enforcing one reviewer to review several changes
■ Can take a lot of time, instead of splitting the review effort
■ Changes can be unrelated and then there is really no reason to send them together
Do: Limit number of commits per PR
● One is usually enough
● There is sometimes a reason for including two
● More than two? Ask yourself if it’s necessary
Don’t: Ignore CI
Don’t: Ignore CI
● Why this is bad?
○ You don’t want to merge something that breaks the project
○ Some reviewers will not review your PR until you fix the issues
Do: Act based on CI results
● CI usually has purpose :)
● Your PR doesn’t pass CI? FIX IT
● Don’t expect the reviewer to provide feedback/vote before you fixed
everything
● There are some good lessons in understand how CI works and why it fails
○ Code styling and conventions
○ Learning more on the tests side (= the dark side for many folks ;] )
Don’t: Commit messages in the code itself
Don’t: Commit messages in the code itself
● Why this is bad?
○ In my opinion comments in code should explain the code itself and commit messages
should explain why a PR was submitted and what its goal
○ Affects readability of the code
● Note: this message is not even a valid commit message :)
Do: Distinguish between commit message and
code comments
● Find some logic that works for you to make code readable and yet, easy for
the reviewer to understand your code
Summary
● Commit messages
○ Structure is important
○ To the point
● Submitter-Reviewer relationship
○ Put yourself in the reviewer shoes
○ Listen to what he/she have to say. No matter how experienced she/he is.
○ It includes some of the dynamics you have when having a technical discussion with
someone face-to-face
● CI
○ Git hooks is a great way to save some time
○ Act based on the results
● Limit number of commits per PR
Project’s guidelines & templates
● Some projects provide their own insights, guidelines and/or templates for
pull requests & commits
○ OpenStack Git commit best practices
○ Ansible template
● GitHub blog post
● When joining a big project or community, check if they have some
predefined guidelines
Open Discussion
● Do you have your own unwritten rules you follow?
● Do you agree with everything I mentioned?
Questions?

More Related Content

What's hot

Code Review Best Practices
Code Review Best PracticesCode Review Best Practices
Code Review Best Practices
Trisha Gee
 
Git challenges
Git challengesGit challenges
Git challenges
Rachel M. Carmena
 
Understanding Branching and Merging in Git
Understanding Branching and Merging in GitUnderstanding Branching and Merging in Git
Understanding Branching and Merging in Git
gittower
 
Starting with Git & GitHub
Starting with Git & GitHubStarting with Git & GitHub
Starting with Git & GitHub
Nicolás Tourné
 
Git and github
Git and githubGit and github
Git and github
Sayantika Banik
 
Git best practices workshop
Git best practices workshopGit best practices workshop
Git best practices workshop
Otto Kekäläinen
 
Trunk-Based Development
Trunk-Based DevelopmentTrunk-Based Development
Trunk-Based Development
Bryan Liu
 
Feature toggling
Feature togglingFeature toggling
Feature toggling
T. Alexander Lystad
 
淡江大學 - 產品測試+安全性測試+壓力測試
淡江大學 - 產品測試+安全性測試+壓力測試淡江大學 - 產品測試+安全性測試+壓力測試
淡江大學 - 產品測試+安全性測試+壓力測試
Taien Wang
 
Feature Toggle
Feature ToggleFeature Toggle
Feature Toggle
Bryan Liu
 
Introduzione a Git
Introduzione a GitIntroduzione a Git
Introduzione a Git
Alfonso Piscitelli
 
はじめてのGit forデザイナー&コーダー
はじめてのGit forデザイナー&コーダーはじめてのGit forデザイナー&コーダー
はじめてのGit forデザイナー&コーダー
Saeko Yamamoto
 
GitLab: One Tool for Software Development (2018-02-06 @ SEIUM, Braga, Portugal)
GitLab: One Tool for Software Development (2018-02-06 @ SEIUM, Braga, Portugal)GitLab: One Tool for Software Development (2018-02-06 @ SEIUM, Braga, Portugal)
GitLab: One Tool for Software Development (2018-02-06 @ SEIUM, Braga, Portugal)
Pedro Moreira da Silva
 
Git hub ppt presentation
Git hub ppt presentationGit hub ppt presentation
Git hub ppt presentation
AyanaRukasar
 
Git workflows
Git workflowsGit workflows
Git workflowsXpand IT
 
ブランチを綺麗に保ち、どうやって本番アップするのか
ブランチを綺麗に保ち、どうやって本番アップするのかブランチを綺麗に保ち、どうやって本番アップするのか
ブランチを綺麗に保ち、どうやって本番アップするのか
Saeko Yamamoto
 
コンポーネント単位で考えるWeb制作
コンポーネント単位で考えるWeb制作コンポーネント単位で考えるWeb制作
コンポーネント単位で考えるWeb制作
祐磨 堀
 
Git One Day Training Notes
Git One Day Training NotesGit One Day Training Notes
Git One Day Training Notes
glen_a_smith
 
テストコードの定型化
テストコードの定型化テストコードの定型化
テストコードの定型化
Shinichi Hirauchi
 
Git and GitHub workflows
Git and GitHub workflowsGit and GitHub workflows
Git and GitHub workflows
Arthur Shvetsov
 

What's hot (20)

Code Review Best Practices
Code Review Best PracticesCode Review Best Practices
Code Review Best Practices
 
Git challenges
Git challengesGit challenges
Git challenges
 
Understanding Branching and Merging in Git
Understanding Branching and Merging in GitUnderstanding Branching and Merging in Git
Understanding Branching and Merging in Git
 
Starting with Git & GitHub
Starting with Git & GitHubStarting with Git & GitHub
Starting with Git & GitHub
 
Git and github
Git and githubGit and github
Git and github
 
Git best practices workshop
Git best practices workshopGit best practices workshop
Git best practices workshop
 
Trunk-Based Development
Trunk-Based DevelopmentTrunk-Based Development
Trunk-Based Development
 
Feature toggling
Feature togglingFeature toggling
Feature toggling
 
淡江大學 - 產品測試+安全性測試+壓力測試
淡江大學 - 產品測試+安全性測試+壓力測試淡江大學 - 產品測試+安全性測試+壓力測試
淡江大學 - 產品測試+安全性測試+壓力測試
 
Feature Toggle
Feature ToggleFeature Toggle
Feature Toggle
 
Introduzione a Git
Introduzione a GitIntroduzione a Git
Introduzione a Git
 
はじめてのGit forデザイナー&コーダー
はじめてのGit forデザイナー&コーダーはじめてのGit forデザイナー&コーダー
はじめてのGit forデザイナー&コーダー
 
GitLab: One Tool for Software Development (2018-02-06 @ SEIUM, Braga, Portugal)
GitLab: One Tool for Software Development (2018-02-06 @ SEIUM, Braga, Portugal)GitLab: One Tool for Software Development (2018-02-06 @ SEIUM, Braga, Portugal)
GitLab: One Tool for Software Development (2018-02-06 @ SEIUM, Braga, Portugal)
 
Git hub ppt presentation
Git hub ppt presentationGit hub ppt presentation
Git hub ppt presentation
 
Git workflows
Git workflowsGit workflows
Git workflows
 
ブランチを綺麗に保ち、どうやって本番アップするのか
ブランチを綺麗に保ち、どうやって本番アップするのかブランチを綺麗に保ち、どうやって本番アップするのか
ブランチを綺麗に保ち、どうやって本番アップするのか
 
コンポーネント単位で考えるWeb制作
コンポーネント単位で考えるWeb制作コンポーネント単位で考えるWeb制作
コンポーネント単位で考えるWeb制作
 
Git One Day Training Notes
Git One Day Training NotesGit One Day Training Notes
Git One Day Training Notes
 
テストコードの定型化
テストコードの定型化テストコードの定型化
テストコードの定型化
 
Git and GitHub workflows
Git and GitHub workflowsGit and GitHub workflows
Git and GitHub workflows
 

Similar to Pull requests do's and don'ts

Effective Code Review
Effective Code ReviewEffective Code Review
Effective Code Review
Eyal Kenig
 
DockerCon US 2016 - Scaling Open Source operations
DockerCon US 2016 - Scaling Open Source operationsDockerCon US 2016 - Scaling Open Source operations
DockerCon US 2016 - Scaling Open Source operations
Arnaud Porterie
 
Software Engineering Primer
Software Engineering PrimerSoftware Engineering Primer
Software Engineering Primer
Georg Buske
 
Picking the right architecture and sticking to it
Picking the right architecture and sticking to itPicking the right architecture and sticking to it
Picking the right architecture and sticking to it
Petter Holmström
 
The Software Development Industry
The Software Development IndustryThe Software Development Industry
The Software Development Industry
Olivier Bourgeois
 
INTERFACE by apidays - Doc Well for your Devrel by Ilona Koren-Deutsch
INTERFACE by apidays - Doc Well for your Devrel by Ilona Koren-DeutschINTERFACE by apidays - Doc Well for your Devrel by Ilona Koren-Deutsch
INTERFACE by apidays - Doc Well for your Devrel by Ilona Koren-Deutsch
apidays
 
The Testers' Secret Weapon - Code Reviews
The Testers' Secret Weapon - Code ReviewsThe Testers' Secret Weapon - Code Reviews
The Testers' Secret Weapon - Code Reviews
Bertold Kolics
 
Balancing Technical Debt and Clean Code
Balancing Technical Debt and Clean CodeBalancing Technical Debt and Clean Code
Balancing Technical Debt and Clean Code
Dave Hulbert
 
Best Practices in Software Development
Best Practices in Software DevelopmentBest Practices in Software Development
Best Practices in Software Development
André Pitombeira
 
Tactical Application Security: Getting Stuff Done - Black Hat Briefings 2015
Tactical Application Security: Getting Stuff Done - Black Hat Briefings 2015Tactical Application Security: Getting Stuff Done - Black Hat Briefings 2015
Tactical Application Security: Getting Stuff Done - Black Hat Briefings 2015
Cory Scott
 
Post agile confessions
Post agile confessionsPost agile confessions
Post agile confessions
Stojan Peshov
 
Practical pointers for better code review
Practical pointers for better code reviewPractical pointers for better code review
Practical pointers for better code review
khink
 
Learning Code Review & Commit Message with Google
Learning Code Review & Commit Message with GoogleLearning Code Review & Commit Message with Google
Learning Code Review & Commit Message with Google
Chang Ru Yang
 
Code review best practice
Code review best practiceCode review best practice
Code review best practice
Oren Digmi
 
Improve Product Design with High Quality Requirements
Improve Product Design with High Quality RequirementsImprove Product Design with High Quality Requirements
Improve Product Design with High Quality Requirements
Elizabeth Steiner
 
Code reviews: a short introduction
Code reviews: a short introductionCode reviews: a short introduction
Code reviews: a short introduction
FreekDB
 
Git Without Branches - Simple, Smooth, Scalable
Git Without Branches - Simple, Smooth, ScalableGit Without Branches - Simple, Smooth, Scalable
Git Without Branches - Simple, Smooth, Scalablepieterh
 
Designing in the open
Designing in the openDesigning in the open
Designing in the open
Catherine Robson
 
Building Sustainable Software: An Introduction to Software Engineering
Building Sustainable Software: An Introduction to Software EngineeringBuilding Sustainable Software: An Introduction to Software Engineering
Building Sustainable Software: An Introduction to Software Engineering
Muhammad Shehata
 
1017191EE 200 Electrical Engineering Design Project.docx
1017191EE 200 Electrical Engineering Design Project.docx1017191EE 200 Electrical Engineering Design Project.docx
1017191EE 200 Electrical Engineering Design Project.docx
aulasnilda
 

Similar to Pull requests do's and don'ts (20)

Effective Code Review
Effective Code ReviewEffective Code Review
Effective Code Review
 
DockerCon US 2016 - Scaling Open Source operations
DockerCon US 2016 - Scaling Open Source operationsDockerCon US 2016 - Scaling Open Source operations
DockerCon US 2016 - Scaling Open Source operations
 
Software Engineering Primer
Software Engineering PrimerSoftware Engineering Primer
Software Engineering Primer
 
Picking the right architecture and sticking to it
Picking the right architecture and sticking to itPicking the right architecture and sticking to it
Picking the right architecture and sticking to it
 
The Software Development Industry
The Software Development IndustryThe Software Development Industry
The Software Development Industry
 
INTERFACE by apidays - Doc Well for your Devrel by Ilona Koren-Deutsch
INTERFACE by apidays - Doc Well for your Devrel by Ilona Koren-DeutschINTERFACE by apidays - Doc Well for your Devrel by Ilona Koren-Deutsch
INTERFACE by apidays - Doc Well for your Devrel by Ilona Koren-Deutsch
 
The Testers' Secret Weapon - Code Reviews
The Testers' Secret Weapon - Code ReviewsThe Testers' Secret Weapon - Code Reviews
The Testers' Secret Weapon - Code Reviews
 
Balancing Technical Debt and Clean Code
Balancing Technical Debt and Clean CodeBalancing Technical Debt and Clean Code
Balancing Technical Debt and Clean Code
 
Best Practices in Software Development
Best Practices in Software DevelopmentBest Practices in Software Development
Best Practices in Software Development
 
Tactical Application Security: Getting Stuff Done - Black Hat Briefings 2015
Tactical Application Security: Getting Stuff Done - Black Hat Briefings 2015Tactical Application Security: Getting Stuff Done - Black Hat Briefings 2015
Tactical Application Security: Getting Stuff Done - Black Hat Briefings 2015
 
Post agile confessions
Post agile confessionsPost agile confessions
Post agile confessions
 
Practical pointers for better code review
Practical pointers for better code reviewPractical pointers for better code review
Practical pointers for better code review
 
Learning Code Review & Commit Message with Google
Learning Code Review & Commit Message with GoogleLearning Code Review & Commit Message with Google
Learning Code Review & Commit Message with Google
 
Code review best practice
Code review best practiceCode review best practice
Code review best practice
 
Improve Product Design with High Quality Requirements
Improve Product Design with High Quality RequirementsImprove Product Design with High Quality Requirements
Improve Product Design with High Quality Requirements
 
Code reviews: a short introduction
Code reviews: a short introductionCode reviews: a short introduction
Code reviews: a short introduction
 
Git Without Branches - Simple, Smooth, Scalable
Git Without Branches - Simple, Smooth, ScalableGit Without Branches - Simple, Smooth, Scalable
Git Without Branches - Simple, Smooth, Scalable
 
Designing in the open
Designing in the openDesigning in the open
Designing in the open
 
Building Sustainable Software: An Introduction to Software Engineering
Building Sustainable Software: An Introduction to Software EngineeringBuilding Sustainable Software: An Introduction to Software Engineering
Building Sustainable Software: An Introduction to Software Engineering
 
1017191EE 200 Electrical Engineering Design Project.docx
1017191EE 200 Electrical Engineering Design Project.docx1017191EE 200 Electrical Engineering Design Project.docx
1017191EE 200 Electrical Engineering Design Project.docx
 

Recently uploaded

IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
Abida Shariff
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ralf Eggert
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
Fwdays
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 

Recently uploaded (20)

IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 

Pull requests do's and don'ts

  • 1. Pull Requests: Do’s & Don’ts Arie Bregman Senior Software Engineer @RedHat
  • 2. Agenda ● Terminology ● Do’s and Don’ts ● Projects guidelines and templates ● Open Discussion ● Questions
  • 3. Commit ● A record of your changes ● Adding your changes to the tree of the repository
  • 4. Pull Request ● A request to submit code ● Pull request can include several commits ● Different systems use different approach for code reviews ○ Gerrit ● Why knowing how to submit pull requests is important?
  • 5. Reviewer ● A person who goes over your changes, comment about them and vote accordingly ● Reviewer can be anyone ○ Technical or Non-technical ○ Someone from your team or external ○ Junior or Senior
  • 6. CI ● What is CI? We need a separate session for this ● Trying to describe the most common workflow would be: ○ An automated process for easily and safely testing your pull request with latest revision of your project ● CI can includes stages like compiling, testing, installing and configuring the project ● Popular CI systems ○ Jenkins ○ Travis
  • 7. Don’t: Meaningless commit messages ● Why this is bad? ○ Reviewer doesn’t know what your code suppose to do ○ In the future, people will not be able to understand why a certain change was done when running for example ‘git log’
  • 9.
  • 10. Don’t: include multiple commits in a single PR
  • 11. Don’t: include multiple commits in a single PR ● Why this is bad? ○ You are enforcing one reviewer to review several changes ■ Can take a lot of time, instead of splitting the review effort ■ Changes can be unrelated and then there is really no reason to send them together
  • 12. Do: Limit number of commits per PR ● One is usually enough ● There is sometimes a reason for including two ● More than two? Ask yourself if it’s necessary
  • 14. Don’t: Ignore CI ● Why this is bad? ○ You don’t want to merge something that breaks the project ○ Some reviewers will not review your PR until you fix the issues
  • 15. Do: Act based on CI results ● CI usually has purpose :) ● Your PR doesn’t pass CI? FIX IT ● Don’t expect the reviewer to provide feedback/vote before you fixed everything ● There are some good lessons in understand how CI works and why it fails ○ Code styling and conventions ○ Learning more on the tests side (= the dark side for many folks ;] )
  • 16. Don’t: Commit messages in the code itself
  • 17. Don’t: Commit messages in the code itself ● Why this is bad? ○ In my opinion comments in code should explain the code itself and commit messages should explain why a PR was submitted and what its goal ○ Affects readability of the code ● Note: this message is not even a valid commit message :)
  • 18. Do: Distinguish between commit message and code comments ● Find some logic that works for you to make code readable and yet, easy for the reviewer to understand your code
  • 19. Summary ● Commit messages ○ Structure is important ○ To the point ● Submitter-Reviewer relationship ○ Put yourself in the reviewer shoes ○ Listen to what he/she have to say. No matter how experienced she/he is. ○ It includes some of the dynamics you have when having a technical discussion with someone face-to-face ● CI ○ Git hooks is a great way to save some time ○ Act based on the results ● Limit number of commits per PR
  • 20. Project’s guidelines & templates ● Some projects provide their own insights, guidelines and/or templates for pull requests & commits ○ OpenStack Git commit best practices ○ Ansible template ● GitHub blog post ● When joining a big project or community, check if they have some predefined guidelines
  • 21. Open Discussion ● Do you have your own unwritten rules you follow? ● Do you agree with everything I mentioned?