Learn GitHub
$ gh ghprofessional.ghprofessional

Professional GitHub Workflows

6 learning objectives · 10 key terms · 7 commands · 3 diagrams · 5 quiz questions

$objectives

Professional GitHub Workflows

Professional Practice

Module 5 of 5 · lesson 20 in this module

What you'll be able to do

  • Choose naming conventions for branches and commits that survive a year of history
  • Add pull request and issue templates that raise the quality of every contribution
  • Use CODEOWNERS to route reviews automatically
  • Apply semantic versioning and maintain a changelog people actually read
  • Structure a monorepo with ownership and per-path CI
  • Define team permissions and repository governance that scales
$concept

The idea, in plain language

A repository that works for one person starts costing the team around the fifth contributor. The symptoms are always the same: branches named after people, commits that say "fix", pull requests with empty descriptions, no one clearly responsible for a directory, and releases that happen whenever somebody remembers. None of that is caused by Git — it is caused by conventions that were never written down. The professional move is to encode the conventions in the repository itself, so they apply automatically rather than being re-litigated in every review.

The tools for that are all files and settings. Naming conventions (feature/…, fix/…, and commit types like feat, fix, docs, refactor, test, chore) make history filterable. A pull request template makes every description answer the same useful questions, and an issue template stops bug reports arriving without reproduction steps. CODEOWNERS automatically requests the right reviewers for each path, which is how a large repository stays reviewable. Tools such as commitlint or a workflow check can enforce the conventions you care about, which is far more reliable than reminding people.

Release discipline completes the picture: semantic versioning that reflects what actually changed, a changelog generated from conventional commits or merged pull request titles, and a single documented way to cut a release. Permissions and governance are the final layer — team roles, branch protection, required reviews for sensitive paths, and a written decision for who can push to main. The test of all of it is simple: a new contributor should be able to open a worthy pull request on their first day without asking a single person how.

$key terms

Key terms

Branch naming convention
A predictable scheme such as feature/login-form or fix/101-session-timeout.
Conventional commits
A message format — type(scope): subject — that tools can parse into changelogs.
Pull request template
.github/pull_request_template.md, which pre-fills every new description.
Issue template
A YAML form or Markdown template in .github/ISSUE_TEMPLATE/.
CODEOWNERS
A file mapping paths to owners, used to request the right reviewers automatically.
Changelog
A human-readable record of what changed in each release, usually generated from commit or PR titles.
Monorepo
One repository containing multiple projects or packages.
Repository role
Permission level for a person: read, triage, write, maintain or admin.
Governance
Written rules for decisions, releases and who may change what.
Release train
A fixed, predictable release schedule rather than ad-hoc releases.
$steps

How it works, step by step

  1. 1
    Write the conventions into the repository

    A CONTRIBUTING.md that states branch names, commit format, how to run tests and what a good pull request looks like. If it only lives in someone’s head, it does not exist.

    CONTRIBUTING.mdmarkdown
    # Contributing
    
    ## Branches
    feature/<slug>, fix/<issue>-<slug>, docs/<slug>, chore/<slug>
    
    ## Commits
    feat:, fix:, docs:, refactor:, test:, chore: — imperative subject under 50 chars
    
    ## Pull requests
    One change per PR, description follows the template, tests must pass locally
  2. 2
    Add templates so quality is the default

    A pull request template turns every description into a useful one, and an issue form collects the details a bug report needs. Put them in .github/ and they apply automatically.

    .github/pull_request_template.mdmarkdown
    ## What
    
    ## Why (linked issue)
    Closes #
    
    ## How I verified it
    - [ ] tests added or updated
    - [ ] ran the suite locally
    
    ## Reviewer notes
  3. 3
    Route reviews with CODEOWNERS

    Map directories to teams so the right reviewers are requested on every change, and combine it with branch protection to require code-owner approval for sensitive paths.

    CODEOWNERSmarkdown
    # .github/CODEOWNERS
    *                 @ada
    /infra/            @ada @platform-team
    /api/              @backend-team
    /docs/             @docs-team
  4. 4
    Adopt conventional commits and generate the changelog

    One format everyone can follow, validated in CI, then parsed for release notes. The rule that matters most is that the type describes the effect on users.

    commit formatbash
    feat(auth): add session refresh endpoint
    fix(export): handle empty tables without crashing
    docs(readme): correct the install command
    refactor(parser): extract tokeniser
    chore(deps): bump lodash to 4.17.21
  5. 5
    Make releases predictable

    A release train — a versioned release every two weeks, for example — removes the debate about when to release. Announce the process, automate the artefact production, and keep the changelog generated rather than handwritten.

    releasebash
    gh release create v2.5.0 --generate-notes --latest
  6. 6
    Set permissions and protect the important branches

    Give contributors the lowest role that works, protect main with required reviews and checks, require code-owner review for sensitive paths, and keep an admin list deliberately short.

    governance in one callbash
    gh api --method PUT repos/:owner/:repo/branches/main/protection \
      -f required_status_checks[strict]=true \
      -f required_pull_request_reviews[require_code_owner_reviews]=true
$commands

Commands worth memorising

Every block below is copy-ready — use the Copy button, then paste it into your terminal. Expected output is shown underneath so you know what “working” looks like.

check the local commit stylebash
git log --oneline -10
Output
a1b2c3d feat(auth): add session refresh endpoint
e4f5a6b fix(export): handle empty tables
c7d8e9f docs(readme): correct the install command

If the log does not read as a list of intentions, the convention is not yet working.

seed a commit templatebash
git config commit.template .gitmessage

A .gitmessage file with the type list in comments nudges every author towards the same format without enforcement.

who changed what, groupedbash
git shortlog -sn --no-merges
Output
    42  Ada Lovelace
    17  Grace Hopper

A quick view of contribution distribution, useful before a release retrospective.

generate the changelogbash
git log --pretty="- %s (%h)" v2.4.1..v2.5.0
Output
- feat: add session refresh endpoint (a1b2c3d)
- fix: handle empty tables in export (e4f5a6b)

Conventional commit subjects make this list readable enough to paste straight into CHANGELOG.md.

require code-owner reviewbash
gh api --method PUT repos/:owner/:repo/branches/main/protection -f required_pull_request_reviews[require_code_owner_reviews]=true

Works only once .github/CODEOWNERS is on the default branch and the owners have write access.

audit who can pushbash
gh api repos/:owner/:repo/collaborators --jq '.[] | "\(.login)  \(.permissions.push | tostring)"'
Output
ada  true
grace  true

Review this list before a security questionnaire: an admin list nobody recognises is the usual finding.

release on the cadencebash
gh release create v2.5.0 --generate-notes --latest

A predictable tag every cycle removes the recurring debate about when to ship.

$diagrams

Workflow diagrams

Diagram 1Conventions that belong in the repository

Each file replaces a rule that would otherwise have to be remembered and repeated in review.

Reading the diagram
  1. Anything a reviewer has to say twice should become a file.
  2. Start with the pull request template and CODEOWNERS — they pay back immediately.
  3. Keep the set small; seven files everybody reads beat twenty nobody does.
Diagram 2Permissions that scale

Least privilege applied to people, not just tokens. Most contributors only ever need write.

Reading the diagram
  1. Start contributors at read or triage and promote on demonstrated need.
  2. Keep the admin list short enough to name from memory.
  3. Protect main so that write access still cannot bypass review.
Diagram 3Code review that people appreciate

Reviews are the main way standards travel through a team, so the tone matters as much as the content.

Reading the diagram
  1. Separate blockers from preferences explicitly, so the author knows what must change.
  2. Review the intent (the description and linked issue) before the implementation.
  3. Aim to unblock: an approving review that lands today beats a perfect review that lands next week.
$example

Worked example

The pull request description a team convention produces, written once and reused for every change.

a reviewable pull requestmarkdown
## What
Adds session refresh so an active user is not logged out at the idle timeout.

## Why
Closes #128. Users were losing form data when the 30-minute idle window expired mid-edit.

## How I verified it
- [x] Added unit tests for refresh at 29 and 31 minutes
- [x] Ran npm test locally (52 passing, 0 failing)
- [x] Manually verified with a 31-minute idle session

## Reviewer notes
The refresh endpoint reuses the existing token signing path, so no new secrets are
required. I deliberately did not change the idle timeout itself — that is a separate
discussion in #130.

## Risk and rollback
Low: the endpoint is additive. Rollback is re-deploying tag v2.4.1.
Output
A reviewer can decide in two minutes: what changed, why, how it was tested, what was intentionally left out, and how to undo it.
1The "What" section states the change in one sentence, so the reviewer knows the shape before reading code.
2The "Why" links the issue, which is where the argument for the change and its alternatives live.
3The verification checklist is evidence, not a claim — it names the tests that cover the new behaviour and the manual check.
4Reviewer notes pre-empt the obvious questions, including the deliberate decision not to change something else.
5Risk and rollback make the deployment decision part of the review instead of a surprise later — this is the section teams forget and the one that saves incidents.
$use cases

Where you'll use it

▸Onboarding a contributor who can open a compliant pull request without asking questions.
▸Keeping a monorepo reviewable by routing each directory to its owning team.
▸Producing release notes automatically from conventional commit messages.
▸Auditing who can push to main during a security review.
▸Standardising a team that has grown from three people to fifteen.
▸Publishing a security policy so vulnerabilities are reported privately rather than in a public issue.
$mistakes

Common mistakes

  • Writing conventions in a wiki that nobody reading a pull request will ever see.
  • Creating twenty issue templates so contributors pick the wrong one out of confusion.
  • Making CODEOWNERS so broad that every change requires three approvals, which kills the review queue.
  • Letting commit message formats become a personal preference instead of a team decision enforced by CI.
  • Hand-maintaining a changelog, which guarantees it will be out of date.
  • Giving admin access to everyone because roles felt like bureaucracy.
  • Treating every review comment as a blocker, so a small change takes two weeks.
$best practices

Best practices

  • Encode conventions as files in the repository, and enforce the important ones in CI.
  • One pull request, one purpose, with a description that answers what, why and how verified.
  • Use conventional commits if you want generated changelogs and semantic version bumps.
  • Keep CODEOWNERS per-directory but keep required approvals low enough that reviews actually happen.
  • Set repository roles by least privilege and keep the admin list short.
  • Release on a predictable cadence and generate the notes.
  • Model the review tone you want to receive: specific, kind, and unblocking.
$exercise

Hands-on exercise

Turn a personal repository into a team-ready one

Seven files and a settings pass that make a repository self-explanatory.

  1. Write a CONTRIBUTING.md stating branch naming, commit format, how to run tests and the pull request expectations.
  2. Add .github/pull_request_template.md with What, Why, How verified, Reviewer notes and Risk/Rollback sections.
  3. Add a bug report issue form under .github/ISSUE_TEMPLATE/ that asks for expected versus actual behaviour, steps to reproduce and environment.
  4. Add .github/CODEOWNERS mapping at least two paths to owners, then open a pull request touching one of them and confirm the reviewer is requested automatically.
  5. Add a CHANGELOG.md and one release entry, then create a matching tag and release with generated notes.
  6. Review the repository roles of your collaborators (or organisation members) and write, in a short GOVERNANCE.md, who may merge to main and how a release is approved.

💡 Hint: CODEOWNERS only takes effect once the file is on the default branch, and the reviewer must have write access for the request to be meaningful.

Done when: A new contributor could read CONTRIBUTING.md, open a pull request against your template, and get the correct reviewer requested without asking anyone.

$quiz

Checkpoint quiz

0 of 5 answered · 0 correct

  1. Multiple choiceQ1

    What is the main purpose of CODEOWNERS?

  2. Multiple choiceQ2

    Which commit message follows the conventional commits format?

  3. TroubleshootingQ3

    A contributor keeps opening pull requests with empty descriptions, and reviewers keep asking the same questions. What is the most effective fix?

  4. True or falseQ4

    True or false: giving every contributor the admin role simplifies repository management.

  5. Multiple choiceQ5

    Why is a release train useful?

$summary

Module summary

  • Encode conventions as files in the repository: CONTRIBUTING, templates, CODEOWNERS, CHANGELOG, workflows.
  • Conventional commits make changelogs and version bumps automatic.
  • CODEOWNERS routes reviews and, with branch protection, can require the right approval.
  • Give each person the lowest role that works, and keep the admin list short.
  • A release train plus generated notes removes the recurring release debate.
  • Review the intent before the diff, mark blockers versus nits, and aim to unblock.
  • The test of a professional repository: a new contributor can contribute correctly on day one without asking.

Next up: Theory is finished. Module 15 is six projects that assemble everything — from a profile README to a production-ready repository with protection, automation and a release.

Recommended resourcesAffiliate links · may earn us a commission

Recommended for learners

Structured coding coursesVideo courses that pair well with visual practice — pick one language and go deep.Browse courses Pro code editor & AI assistantWrite, debug and explain code faster while you practice the patterns here.Try it free Classic DSA interview booksThe reference books interviewers themselves learned from — great next to the visualizers.See the books

Practice what you learned

Put the GitHub course to work: open one of the company-wise repositories and follow the workflow you just learned, branch to release.