SlideShare uma empresa Scribd logo
1 de 29
Git: Pull Requests
Better Collaboration and Code Reviews
About me
Callon Campbell
Full-stack developer / technical lead. With over 19 years of experience
developing desktop, mobile and web enterprise applications using
Microsoft .NET Framework, SQL Server and Azure technologies.
Co-founder of ReflectSoftware Inc and one the principle developers of
ReflectInsight, a real-time .NET logging/analytics framework and
Live/Log Viewer.
Email: CallonCampbell@Outlook.com Twitter: @Flying_Maverick, @DevelopAzure
Blog: TheFlyingMaverick.com LinkedIn: LinkedIn.com/in/calloncampbell
Website: ReflectInsight.com
Using Pull Requests
Pull Requests are living conversations that streamline the process of discussing,
reviewing, and managing changes to code
Each Pull Request takes into account not only what you would like pulled, but
also where you intend those changes to be applied. From there, your team can
discuss the changes as a whole, individual parts, or even specific lines. Later commits
addressing concerns or ideas appear as part of the conversation.
Pull Request = Code + Issue + Code Comments
Collaborative Development
Collaboration is an essential part of the GitHub workflow. After creating a branch and
making one or more commits, a Pull Request starts the conversation around the
proposed changes
At any time anyone can provide feedback on the proposed changes. This feedback can
take in account coding style, best practices, performance, etc
Additional commits are commonly added to the pull request based on feedback
before merging to the branch
Initiate Discussion
Pull Requests initiate discussion about your commits. Because they're tightly
integrated with the underlying Git repository, anyone can see exactly what changes
would be merged if they accept your request.
You can open a Pull Request at any point during the development process: when you
have little or no code but want to share some screenshots or general ideas, when
you're stuck and need help or advice, or when you're ready for someone to review
your work.
By using GitHub's @mention system in your Pull Request message, you can ask for
feedback from specific people or teams, whether they're across the room or working
remotely.
Discuss and Review Your Code
Once a Pull Request has been opened, the person or team reviewing your changes
may have questions or comments. Perhaps the coding style doesn't match project
guidelines, the change is missing unit tests, or maybe everything looks great and
props are in order. Pull Requests are designed to encourage and capture this type of
conversation.
You can also continue to push to your branch in light of discussion and feedback
about your commits. If someone comments that you forgot to do something or if
there is a bug in the code, you can fix it in your branch and push up the change.
GitHub will show your new commits and any additional feedback you may receive in
the unified Pull Request view.
Topic Branches
A “topic” branch is a separate branch that you use when working on a single “topic”
(a bug fix, a new feature, or an experimental idea). Working on a topic branch instead
of directly on top of “master” is recommended because:
- work on multiple, separate topics simultaneously
- can be easily updated
- feedback and related changed are group together
- easier to refactor a patch
Topic branches are meant to be short lived. Once done and their merged into the
parent or you want to discard your changes…just delete the topic branch – both
locally and on the remote.
Topic Branch Workflow
CI
B
B CI CI
CI CI RI
CI RI
Pull request
Pull request
CI CI CI CI
Topic branches
R
R
Symbo
l
Name
B Branch
CI Checkin
R Rebase
RI Reverse Integration
Advanced Topic Branch Workflow
If your topic branch is long lived then you can use “git rebase” to keep it up to
date.
Rebase
There is no merge, so your patches are guaranteed to apply without merge conflicts.
If there are any merge conflicts you will have already resolved them when you ran “git
rebase”
This appropriately shifts the burden of resolving merge conflicts away from the
central integrator onto the contributor; in this way the project can scale to have many
contributors without the integrator becoming a bottleneck
Merge vs Rebase
With a merge, you create a new merge commit.
With rebase there is no merge, so you don’t create a merge commit
Demo
Creating a Topic Branch
1. In Team Explorer pane, go to Branches and right click on the
branch you want to work off and select New Local Branch
From…
Creating a Pull Request
Once you’re happy with your commits, you create a pull request to propose and
collaborate on your proposed changes to a repository. These changes are proposed in
a branch, which ensures that the master (parent) branch is kept clean and tidy.
Pull requests let you tell others about the changes you’ve pushed to a repository.
Once a pull request is sent, interested parties can review the set of changes, discuss
potential modifications and even pull follow-up commits if necessary.
Setting Guidelines - Pull Request
Templates
GitHub has added support for defining Issue and Pull Request templates for a project,
helping contributors add the right details at the start of a thread…
As a group we can define “our”
template which could look like this:
- Coding guidelines
- Unit Tests
- Performance considerations
- Best practices
Demo
Creating a Pull Request
1. On GitHub, navigate to the main page of the repository
2. In the “Branch” menu, choose the branch that contains your
commits
3. To the right of the Branch menu, click New pull request
4. The Compare page will automatically select the base and
compare branches; to change these click Edit
5. On the Compare page, click Create pull request
6. Type a title and description for your pull request
7. Click Create pull request
Merging Pull Requests
You can merge pull requests by either retaining all
the commits in a feature branch or by squashing all
commits into a single commit.
When confirming the merge, there are two options
for the merge:
1. Create a merge commit
- All commits from this branch will be added to
the base branch via a merge commit
2. Squash and merge
- The x number of commits from this branch will
be combined into one commit in the base branch
Merge Squashing
When you merge a pull request, you can squash all commits into a single commit.
Merge squashing retains all your pull request changes, but omits the individual
commits from the Git history.
When you merge a pull request and squash commits, you gain a more streamlined
history that doesn’t include individual commits.
Individual commits create a detailed log of your feature branch but can be
unnecessary when viewing the history of your base branch.
Closing Pull Requests
After a pull request is successfully merged and closed, your branch can safely be
deleted.
Reverting a Pull Request
You can revert a pull request after it's been merged to the upstream branch.
Reverting a pull request on GitHub creates a new pull request that contains one
revert of the merge commit from the original merged pull request.
Demo
Merging a Pull Request
1. On GitHub, navigate to the main page of the repository
Typical Pull Request Workflow
When dealing with pull requests you typically have two
choices:
1. Merge and pray
2. Pull to local branch, build, run tests and merge if all OK
What do you do?
I know what I’d like to do, and GitHub makes it so tempting:
But unfortunately I go with the second option, which is a
pain.
Is a better way?
YES
TeamCity: Automatically Building Pull
Requests
There is a plugin for TeamCity can automatically build GitHub pull requests and
provide build status notifications.
This works by TeamCity monitoring all branches including pull requests. It will then
checkout the pull request and do a “merge” against the parent branch.
The change status is then reported back to GitHub for the given branch.
Pull Request Notification
Pull request notifications makes the code
review process easier by letting the
reviewer know that if this code is merged,
all tests will pass.
Now the reviewer can focus on reviewing
the code and not worry about checking out,
building and running tests.
GitHub Branch Status Checks
With branch protection enabled, certain status checks must pass before branches
can be merged.
Wrap Up
A Pull Request starts the conversation around the proposed changes
A “topic” branch is a separate branch that you use when working on a single “topic”
(a bug fix, a new feature, or an experimental idea) and is meant for short duration
Use git rebase to keep your branch up to date and with rebase, there is no merge, so
your patches are guaranteed to apply without merge conflicts
When merging a pull request, use squash commits so that you gain a more
streamlined history that doesn’t include individual commits
Finally, leverage TeamCity Pull Request Notification to help you with reviewing and
merging pull requests – knowing that the pull request has been built and all tests
have passed based on the merge
Homework - Blog Posts
Add Reactions to Pull Requests, Issues, and Comments
Issue and Pull Request templates
Improved commenting with Markdown
Add Reactions to Pull Requests, Issues, and Comments
More code review tools
Protected Branches Improvements
Squash your commits
References
https://help.github.com/articles/using-pull-requests/
https://help.github.com/articles/merging-a-pull-request/
https://help.github.com/articles/about-pull-request-merge-squashing/
https://help.github.com/articles/closing-issues-via-commit-messages/
https://help.github.com/articles/creating-a-pull-request-template-for-your-
repository/
https://github.com/dchelimsky/rspec/wiki/Topic-Branches
https://git-scm.com/docs/git-revert.html
Questions

Mais conteúdo relacionado

Mais procurados

Using Git and BitBucket
Using Git and BitBucketUsing Git and BitBucket
Using Git and BitBucket
Medhat Dawoud
 
Git with bitbucket
Git with bitbucketGit with bitbucket
Git with bitbucket
Sumin Byeon
 

Mais procurados (20)

GitHub Basics - Derek Bable
GitHub Basics - Derek BableGitHub Basics - Derek Bable
GitHub Basics - Derek Bable
 
Intro to Git and GitHub
Intro to Git and GitHubIntro to Git and GitHub
Intro to Git and GitHub
 
BitBucket presentation
BitBucket presentationBitBucket presentation
BitBucket presentation
 
Github - Git Training Slides: Foundations
Github - Git Training Slides: FoundationsGithub - Git Training Slides: Foundations
Github - Git Training Slides: Foundations
 
Advanced Git Presentation By Swawibe
Advanced Git Presentation By SwawibeAdvanced Git Presentation By Swawibe
Advanced Git Presentation By Swawibe
 
Using Git and BitBucket
Using Git and BitBucketUsing Git and BitBucket
Using Git and BitBucket
 
Git One Day Training Notes
Git One Day Training NotesGit One Day Training Notes
Git One Day Training Notes
 
Git with bitbucket
Git with bitbucketGit with bitbucket
Git with bitbucket
 
git and github
git and githubgit and github
git and github
 
Starting with Git & GitHub
Starting with Git & GitHubStarting with Git & GitHub
Starting with Git & GitHub
 
Introduction git
Introduction gitIntroduction git
Introduction git
 
Git - Basic Crash Course
Git - Basic Crash CourseGit - Basic Crash Course
Git - Basic Crash Course
 
Git
GitGit
Git
 
Introduction to git & GitHub
Introduction to git & GitHubIntroduction to git & GitHub
Introduction to git & GitHub
 
Git Version Control System
Git Version Control SystemGit Version Control System
Git Version Control System
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
Git vs svn
Git vs svnGit vs svn
Git vs svn
 
Introducing GitLab (September 2018)
Introducing GitLab (September 2018)Introducing GitLab (September 2018)
Introducing GitLab (September 2018)
 
Git basic
Git basicGit basic
Git basic
 
GIT presentation
GIT presentationGIT presentation
GIT presentation
 

Semelhante a Git Pull Requests

Semelhante a Git Pull Requests (20)

Introduction to Git (part 3)
Introduction to Git (part 3)Introduction to Git (part 3)
Introduction to Git (part 3)
 
Version control git day02
Version control   git day02Version control   git day02
Version control git day02
 
Version control git day01
Version control   git day01Version control   git day01
Version control git day01
 
Version control git day01
Version control   git day01Version control   git day01
Version control git day01
 
Technical Seminar Series: GIT Pull Requests Best Practices
Technical Seminar Series:  GIT Pull Requests Best PracticesTechnical Seminar Series:  GIT Pull Requests Best Practices
Technical Seminar Series: GIT Pull Requests Best Practices
 
A Git MVP Workflow
A Git MVP WorkflowA Git MVP Workflow
A Git MVP Workflow
 
Get Git with It! A Developer's Workshop.pptx
Get Git with It! A Developer's Workshop.pptxGet Git with It! A Developer's Workshop.pptx
Get Git with It! A Developer's Workshop.pptx
 
Advance workshop on git
Advance workshop on gitAdvance workshop on git
Advance workshop on git
 
Workshop on Git and GitHub
Workshop on Git and GitHubWorkshop on Git and GitHub
Workshop on Git and GitHub
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
A Tutorial for GitHub.pdf
A Tutorial for GitHub.pdfA Tutorial for GitHub.pdf
A Tutorial for GitHub.pdf
 
A Tutorial for GitHub.pdf
A Tutorial for GitHub.pdfA Tutorial for GitHub.pdf
A Tutorial for GitHub.pdf
 
[2015/2016] Collaborative software development with Git
[2015/2016] Collaborative software development with Git[2015/2016] Collaborative software development with Git
[2015/2016] Collaborative software development with Git
 
Introduction to github slideshare
Introduction to github slideshareIntroduction to github slideshare
Introduction to github slideshare
 
Git and Github slides.pdf
Git and Github slides.pdfGit and Github slides.pdf
Git and Github slides.pdf
 
Git and Github workshop ppt slide by slide
Git and Github workshop ppt slide by slideGit and Github workshop ppt slide by slide
Git and Github workshop ppt slide by slide
 
Git hub party-20151008
Git hub party-20151008Git hub party-20151008
Git hub party-20151008
 
GITHUB
GITHUBGITHUB
GITHUB
 
E caregitpresentation
E caregitpresentationE caregitpresentation
E caregitpresentation
 
Git best practices 2016
Git best practices 2016Git best practices 2016
Git best practices 2016
 

Mais de Callon Campbell

Mais de Callon Campbell (20)

Global Azure 2023 - Building Multitenant SaaS Applications in Azure
Global Azure 2023 - Building Multitenant SaaS Applications in AzureGlobal Azure 2023 - Building Multitenant SaaS Applications in Azure
Global Azure 2023 - Building Multitenant SaaS Applications in Azure
 
Getting started with Azure Functions in Isolated Mode
Getting started with Azure Functions in Isolated ModeGetting started with Azure Functions in Isolated Mode
Getting started with Azure Functions in Isolated Mode
 
Azure Durable Functions: The Festive Magic of Scalable Serverless Workflows f...
Azure Durable Functions: The Festive Magic of Scalable Serverless Workflows f...Azure Durable Functions: The Festive Magic of Scalable Serverless Workflows f...
Azure Durable Functions: The Festive Magic of Scalable Serverless Workflows f...
 
Global Azure 2024 - On-Premises to Azure Cloud: .NET Web App Journey
Global Azure 2024 - On-Premises to Azure Cloud: .NET Web App JourneyGlobal Azure 2024 - On-Premises to Azure Cloud: .NET Web App Journey
Global Azure 2024 - On-Premises to Azure Cloud: .NET Web App Journey
 
Festive Tech Calendar 2021
Festive Tech Calendar 2021Festive Tech Calendar 2021
Festive Tech Calendar 2021
 
Festive Tech Calendar 2022
Festive Tech Calendar 2022Festive Tech Calendar 2022
Festive Tech Calendar 2022
 
BestOfBuild2021 - Azure Functions (15min).pptx
BestOfBuild2021 - Azure Functions (15min).pptxBestOfBuild2021 - Azure Functions (15min).pptx
BestOfBuild2021 - Azure Functions (15min).pptx
 
Whats new in Azure Functions and .NET 6.pptx
Whats new in Azure Functions and .NET 6.pptxWhats new in Azure Functions and .NET 6.pptx
Whats new in Azure Functions and .NET 6.pptx
 
Global Azure 2022 - Architecting Modern Serverless APIs with Azure Functions ...
Global Azure 2022 - Architecting Modern Serverless APIs with Azure Functions ...Global Azure 2022 - Architecting Modern Serverless APIs with Azure Functions ...
Global Azure 2022 - Architecting Modern Serverless APIs with Azure Functions ...
 
Building stateful serverless orchestrations with Azure Durable Azure Function...
Building stateful serverless orchestrations with Azure Durable Azure Function...Building stateful serverless orchestrations with Azure Durable Azure Function...
Building stateful serverless orchestrations with Azure Durable Azure Function...
 
Building scalable applications using serverless on the cloud
Building scalable applications using serverless on the cloudBuilding scalable applications using serverless on the cloud
Building scalable applications using serverless on the cloud
 
Bringing Serverless into the Enterprise (Global Azure Virtual 2020)
Bringing Serverless into the Enterprise (Global Azure Virtual 2020)Bringing Serverless into the Enterprise (Global Azure Virtual 2020)
Bringing Serverless into the Enterprise (Global Azure Virtual 2020)
 
Developing scalable enterprise serverless applications on azure with .net
Developing scalable enterprise serverless applications on azure with .netDeveloping scalable enterprise serverless applications on azure with .net
Developing scalable enterprise serverless applications on azure with .net
 
Exposing services with Azure API Management
Exposing services with Azure API ManagementExposing services with Azure API Management
Exposing services with Azure API Management
 
Build embedded and IoT solutions with Microsoft Windows IoT Core (BRK30077)
Build embedded and IoT solutions with Microsoft Windows IoT Core (BRK30077)Build embedded and IoT solutions with Microsoft Windows IoT Core (BRK30077)
Build embedded and IoT solutions with Microsoft Windows IoT Core (BRK30077)
 
Centralized configuration with azure app configuration
Centralized configuration with azure app configurationCentralized configuration with azure app configuration
Centralized configuration with azure app configuration
 
Creating Event Driven Applications with Azure Event Grid
Creating Event Driven Applications with Azure Event GridCreating Event Driven Applications with Azure Event Grid
Creating Event Driven Applications with Azure Event Grid
 
Getting Started with Azure Artifacts
Getting Started with Azure ArtifactsGetting Started with Azure Artifacts
Getting Started with Azure Artifacts
 
Serverless Orchestration with Azure Durable Functions
Serverless Orchestration with Azure Durable FunctionsServerless Orchestration with Azure Durable Functions
Serverless Orchestration with Azure Durable Functions
 
Azure DevOps in Action
Azure DevOps in ActionAzure DevOps in Action
Azure DevOps in Action
 

Último

%+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 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
 
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
 
+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
 

Último (20)

WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
 
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...
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
%+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...
 
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
 
%+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...
 
%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
 
WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security Program
 
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...
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
What Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationWhat Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the Situation
 
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
 
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
 
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
 
+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...
 
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
 
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 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
 
%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
 
WSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - Keynote
 

Git Pull Requests

  • 1. Git: Pull Requests Better Collaboration and Code Reviews
  • 2. About me Callon Campbell Full-stack developer / technical lead. With over 19 years of experience developing desktop, mobile and web enterprise applications using Microsoft .NET Framework, SQL Server and Azure technologies. Co-founder of ReflectSoftware Inc and one the principle developers of ReflectInsight, a real-time .NET logging/analytics framework and Live/Log Viewer. Email: CallonCampbell@Outlook.com Twitter: @Flying_Maverick, @DevelopAzure Blog: TheFlyingMaverick.com LinkedIn: LinkedIn.com/in/calloncampbell Website: ReflectInsight.com
  • 3. Using Pull Requests Pull Requests are living conversations that streamline the process of discussing, reviewing, and managing changes to code Each Pull Request takes into account not only what you would like pulled, but also where you intend those changes to be applied. From there, your team can discuss the changes as a whole, individual parts, or even specific lines. Later commits addressing concerns or ideas appear as part of the conversation. Pull Request = Code + Issue + Code Comments
  • 4. Collaborative Development Collaboration is an essential part of the GitHub workflow. After creating a branch and making one or more commits, a Pull Request starts the conversation around the proposed changes At any time anyone can provide feedback on the proposed changes. This feedback can take in account coding style, best practices, performance, etc Additional commits are commonly added to the pull request based on feedback before merging to the branch
  • 5. Initiate Discussion Pull Requests initiate discussion about your commits. Because they're tightly integrated with the underlying Git repository, anyone can see exactly what changes would be merged if they accept your request. You can open a Pull Request at any point during the development process: when you have little or no code but want to share some screenshots or general ideas, when you're stuck and need help or advice, or when you're ready for someone to review your work. By using GitHub's @mention system in your Pull Request message, you can ask for feedback from specific people or teams, whether they're across the room or working remotely.
  • 6. Discuss and Review Your Code Once a Pull Request has been opened, the person or team reviewing your changes may have questions or comments. Perhaps the coding style doesn't match project guidelines, the change is missing unit tests, or maybe everything looks great and props are in order. Pull Requests are designed to encourage and capture this type of conversation. You can also continue to push to your branch in light of discussion and feedback about your commits. If someone comments that you forgot to do something or if there is a bug in the code, you can fix it in your branch and push up the change. GitHub will show your new commits and any additional feedback you may receive in the unified Pull Request view.
  • 7. Topic Branches A “topic” branch is a separate branch that you use when working on a single “topic” (a bug fix, a new feature, or an experimental idea). Working on a topic branch instead of directly on top of “master” is recommended because: - work on multiple, separate topics simultaneously - can be easily updated - feedback and related changed are group together - easier to refactor a patch Topic branches are meant to be short lived. Once done and their merged into the parent or you want to discard your changes…just delete the topic branch – both locally and on the remote.
  • 8. Topic Branch Workflow CI B B CI CI CI CI RI CI RI Pull request Pull request CI CI CI CI Topic branches R R Symbo l Name B Branch CI Checkin R Rebase RI Reverse Integration
  • 9. Advanced Topic Branch Workflow If your topic branch is long lived then you can use “git rebase” to keep it up to date.
  • 10. Rebase There is no merge, so your patches are guaranteed to apply without merge conflicts. If there are any merge conflicts you will have already resolved them when you ran “git rebase” This appropriately shifts the burden of resolving merge conflicts away from the central integrator onto the contributor; in this way the project can scale to have many contributors without the integrator becoming a bottleneck
  • 11. Merge vs Rebase With a merge, you create a new merge commit. With rebase there is no merge, so you don’t create a merge commit
  • 12. Demo Creating a Topic Branch 1. In Team Explorer pane, go to Branches and right click on the branch you want to work off and select New Local Branch From…
  • 13. Creating a Pull Request Once you’re happy with your commits, you create a pull request to propose and collaborate on your proposed changes to a repository. These changes are proposed in a branch, which ensures that the master (parent) branch is kept clean and tidy. Pull requests let you tell others about the changes you’ve pushed to a repository. Once a pull request is sent, interested parties can review the set of changes, discuss potential modifications and even pull follow-up commits if necessary.
  • 14. Setting Guidelines - Pull Request Templates GitHub has added support for defining Issue and Pull Request templates for a project, helping contributors add the right details at the start of a thread… As a group we can define “our” template which could look like this: - Coding guidelines - Unit Tests - Performance considerations - Best practices
  • 15. Demo Creating a Pull Request 1. On GitHub, navigate to the main page of the repository 2. In the “Branch” menu, choose the branch that contains your commits 3. To the right of the Branch menu, click New pull request 4. The Compare page will automatically select the base and compare branches; to change these click Edit 5. On the Compare page, click Create pull request 6. Type a title and description for your pull request 7. Click Create pull request
  • 16. Merging Pull Requests You can merge pull requests by either retaining all the commits in a feature branch or by squashing all commits into a single commit. When confirming the merge, there are two options for the merge: 1. Create a merge commit - All commits from this branch will be added to the base branch via a merge commit 2. Squash and merge - The x number of commits from this branch will be combined into one commit in the base branch
  • 17. Merge Squashing When you merge a pull request, you can squash all commits into a single commit. Merge squashing retains all your pull request changes, but omits the individual commits from the Git history. When you merge a pull request and squash commits, you gain a more streamlined history that doesn’t include individual commits. Individual commits create a detailed log of your feature branch but can be unnecessary when viewing the history of your base branch.
  • 18. Closing Pull Requests After a pull request is successfully merged and closed, your branch can safely be deleted.
  • 19. Reverting a Pull Request You can revert a pull request after it's been merged to the upstream branch. Reverting a pull request on GitHub creates a new pull request that contains one revert of the merge commit from the original merged pull request.
  • 20. Demo Merging a Pull Request 1. On GitHub, navigate to the main page of the repository
  • 21. Typical Pull Request Workflow When dealing with pull requests you typically have two choices: 1. Merge and pray 2. Pull to local branch, build, run tests and merge if all OK What do you do? I know what I’d like to do, and GitHub makes it so tempting: But unfortunately I go with the second option, which is a pain.
  • 22. Is a better way? YES
  • 23. TeamCity: Automatically Building Pull Requests There is a plugin for TeamCity can automatically build GitHub pull requests and provide build status notifications. This works by TeamCity monitoring all branches including pull requests. It will then checkout the pull request and do a “merge” against the parent branch. The change status is then reported back to GitHub for the given branch.
  • 24. Pull Request Notification Pull request notifications makes the code review process easier by letting the reviewer know that if this code is merged, all tests will pass. Now the reviewer can focus on reviewing the code and not worry about checking out, building and running tests.
  • 25. GitHub Branch Status Checks With branch protection enabled, certain status checks must pass before branches can be merged.
  • 26. Wrap Up A Pull Request starts the conversation around the proposed changes A “topic” branch is a separate branch that you use when working on a single “topic” (a bug fix, a new feature, or an experimental idea) and is meant for short duration Use git rebase to keep your branch up to date and with rebase, there is no merge, so your patches are guaranteed to apply without merge conflicts When merging a pull request, use squash commits so that you gain a more streamlined history that doesn’t include individual commits Finally, leverage TeamCity Pull Request Notification to help you with reviewing and merging pull requests – knowing that the pull request has been built and all tests have passed based on the merge
  • 27. Homework - Blog Posts Add Reactions to Pull Requests, Issues, and Comments Issue and Pull Request templates Improved commenting with Markdown Add Reactions to Pull Requests, Issues, and Comments More code review tools Protected Branches Improvements Squash your commits

Notas do Editor

  1. After you add changes to a topic branch, you can open a pull request to ask the repository administrator to review your changes before merging them into her project. Pull requests act as code reviews and discussions for a piece of work.
  2. it allows you to work on multiple, separate topics simultaneously without having them all jumbled together in a single branch topic branches are easily updated, which means that if the remote “master” evolves while you are working on your topic it is easy to incorporate those changes into your local topic branch before submitting (which in turn will make your topic apply cleanly on top of the current “master”) if you receive feedback on your patches, having all the related changes grouped together in a topic makes it easy to tweak them and resubmit working on a topic branch makes it easy to refactor a patch series into a logical, clear, clean sequence, which in turn makes your contribution easier to review and more likely to be included
  3. B – Branch CI – Checkin R – Rebase RI – Reverse Integration