Skip to content

Commit 5068cf2

Browse files
authored
Merge pull request #53495 from Albertyang0/NEW-github-enterprise-server-repository-workflows
New Module: Repositories, Branching & Collaboration on GitHub Enterprise Server
2 parents f45fc68 + a437278 commit 5068cf2

14 files changed

Lines changed: 582 additions & 0 deletions
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
### YamlMime:ModuleUnit
2+
uid: learn.github.github-enterprise-server-repository-workflows.repository-creation-organization
3+
title: Repository creation and organization on GHES
4+
metadata:
5+
title: Repository Creation and Organization on GHES
6+
description: This content is a part of the Repositories, Branching & Collaboration on GitHub Enterprise Server module.
7+
author: camihmerhar
8+
ms.author: camhernandez
9+
ms.date: 02/16/2026
10+
ms.topic: unit
11+
durationInMinutes: 5
12+
content: |
13+
[!include[](includes/1-repository-creation-organization.md)]
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
### YamlMime:ModuleUnit
2+
uid: learn.github.github-enterprise-server-repository-workflows.branch-strategies
3+
title: Branching strategies in enterprise repositories
4+
metadata:
5+
title: Branching Strategies in Enterprise Repositories
6+
description: This content is a part of the Repositories, Branching & Collaboration on GitHub Enterprise Server module.
7+
author: camihmerhar
8+
ms.author: camhernandez
9+
ms.date: 02/16/2026
10+
ms.topic: unit
11+
durationInMinutes: 5
12+
content: |
13+
[!include[](includes/2-branch-strategies.md)]
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
### YamlMime:ModuleUnit
2+
uid: learn.github.github-enterprise-server-repository-workflows.branch-protection-rules
3+
title: Branch protections rules and review requirements
4+
metadata:
5+
title: Branch Protection Rules and Review Requirements
6+
description: This content is a part of the Repositories, Branching & Collaboration on GitHub Enterprise Server module.
7+
author: camihmerhar
8+
ms.author: camhernandez
9+
ms.date: 02/16/2026
10+
ms.topic: unit
11+
durationInMinutes: 5
12+
content: |
13+
[!include[](includes/3-branch-protection-rules.md)]
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
### YamlMime:ModuleUnit
2+
uid: learn.github.github-enterprise-server-repository-workflows.pull-request-review
3+
title: Pull requests and code review on GHES
4+
metadata:
5+
title: Pull Requests and Code Review on GHES
6+
description: This content is a part of the Repositories, Branching & Collaboration on GitHub Enterprise Server module.
7+
author: camihmerhar
8+
ms.author: camhernandez
9+
ms.date: 02/16/2026
10+
ms.topic: unit
11+
durationInMinutes: 5
12+
content: |
13+
[!include[](includes/4-pull-request-review.md)]
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
### YamlMime:ModuleUnit
2+
uid: learn.github.github-enterprise-server-repository-workflows.collaboration-constraints
3+
title: Collaboration within GHES constraints
4+
metadata:
5+
title: Collaboration Within GHES Constraints
6+
description: This content is a part of the Repositories, Branching & Collaboration on GitHub Enterprise Server module.
7+
author: camihmerhar
8+
ms.author: camhernandez
9+
ms.date: 02/16/2026
10+
ms.topic: unit
11+
durationInMinutes: 5
12+
content: |
13+
[!include[](includes/5-collaboration-constraints.md)]
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
### YamlMime:ModuleUnit
2+
uid: learn.github.github-enterprise-server-repository-workflows.knowledge-check
3+
title: Knowledge check
4+
metadata:
5+
unitType: knowledge-check
6+
title: Knowledge Check
7+
description: Knowledge check for the Repositories, Branching & Collaboration on GitHub Enterprise Server module.
8+
ms.date: 02/16/2026
9+
author: camihmerhar
10+
ms.author: camhernandez
11+
ms.topic: unit
12+
durationInMinutes: 5
13+
content: |
14+
quiz:
15+
questions:
16+
- content: "Why do enterprises commonly restrict direct pushes to the default branch?"
17+
choices:
18+
- content: "To reduce repository size."
19+
isCorrect: false
20+
explanation: "Incorrect. Restricting direct pushes is intended to enforce governance processes rather than manage repository size."
21+
- content: "To enforce review, testing, and auditability."
22+
isCorrect: true
23+
explanation: "Correct. Protected default branches ensure changes go through pull requests with reviews, automated checks, and auditable history."
24+
- content: "To limit developer access."
25+
isCorrect: false
26+
explanation: "Incorrect. The goal is governance and quality control, not restricting legitimate collaboration."
27+
- content: "Because GHES does not support direct pushes."
28+
isCorrect: false
29+
explanation: "Incorrect. GHES supports direct pushes, but organizations often restrict them through branch protection policies."
30+
- content: "What is the primary purpose of branch protection rules?"
31+
choices:
32+
- content: "Improve UI performance."
33+
isCorrect: false
34+
explanation: "Incorrect. Branch protection rules focus on governance and merge requirements rather than performance."
35+
- content: "Enforce collaboration and governance policies."
36+
isCorrect: true
37+
explanation: "Correct. Branch protection rules define required conditions such as approvals, status checks, and pull request workflows before merging."
38+
- content: "Automatically resolve merge conflicts."
39+
isCorrect: false
40+
explanation: "Incorrect. Merge conflicts must be resolved manually or through supported workflows."
41+
- content: "Replace pull requests."
42+
isCorrect: false
43+
explanation: "Incorrect. Branch protection rules typically require pull requests rather than replace them."
44+
- content: "Why are pull requests especially important in GHES environments?"
45+
choices:
46+
- content: "They reduce storage usage."
47+
isCorrect: false
48+
explanation: "Incorrect. Pull requests are primarily used for collaboration and governance, not storage optimization."
49+
- content: "They enable GitHub Actions."
50+
isCorrect: false
51+
explanation: "Incorrect. GitHub Actions can run independently of pull request usage."
52+
- content: "They provide collaboration, control, and traceability."
53+
isCorrect: true
54+
explanation: "Correct. Pull requests capture discussions, reviews, automated checks, and merge decisions, supporting enterprise traceability."
55+
- content: "They eliminate the need for documentation."
56+
isCorrect: false
57+
explanation: "Incorrect. Documentation remains important alongside pull request workflows."
58+
- content: "Your pull request has an approval, but the merge option is disabled because a required status check is failing. What should you do first?"
59+
choices:
60+
- content: "Push directly to the protected branch to bypass the pull request."
61+
isCorrect: false
62+
explanation: "Incorrect. Protected branches prevent bypassing required checks."
63+
- content: "Ask a teammate to merge it without fixing the check."
64+
isCorrect: false
65+
explanation: "Incorrect. Required status checks must pass before merging."
66+
- content: "Investigate and fix the failing check, then re-run validation."
67+
isCorrect: true
68+
explanation: "Correct. Required status checks must succeed before the pull request meets merge requirements."
69+
- content: "Delete and recreate the branch."
70+
isCorrect: false
71+
explanation: "Incorrect. Recreating the branch does not resolve failing validation checks."
72+
- content: "A pull request modifies a directory that requires review from code owners, but no code owner has approved it. What is the most likely next step?"
73+
choices:
74+
- content: "Merge anyway because at least one reviewer approved."
75+
isCorrect: false
76+
explanation: "Incorrect. Required CODEOWNERS approvals must be satisfied before merging."
77+
- content: "Request review from the required code owners and wait for approval."
78+
isCorrect: true
79+
explanation: "Correct. When CODEOWNERS reviews are required, designated owners must approve changes affecting their paths."
80+
- content: "Convert the pull request to a draft and merge immediately."
81+
isCorrect: false
82+
explanation: "Incorrect. Draft status does not bypass review requirements."
83+
- content: "Delete the branch protection rule."
84+
isCorrect: false
85+
explanation: "Incorrect. Branch protection rules enforce governance policies and should not be removed to bypass requirements."
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
### YamlMime:ModuleUnit
2+
uid: learn.github.github-enterprise-server-repository-workflows.summary
3+
title: Summary
4+
metadata:
5+
unitType: summary
6+
title: Summary
7+
description: This content is a part of the Repositories, Branching & Collaboration on GitHub Enterprise Server module.
8+
ms.date: 02/16/2026
9+
author: camihmerhar
10+
ms.author: camhernandez
11+
ms.topic: unit
12+
durationInMinutes: 1
13+
content: |
14+
[!include[](includes/7-summary.md)]
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
Repositories on GitHub Enterprise Server exist within a structured enterprise hierarchy that reflects organizational ownership, access control, and governance requirements. While the basic repository concept is identical to GitHub.com, the way repositories are created and managed is often more deliberate and controlled.
2+
3+
### In this unit, you'll learn
4+
5+
- How repositories are organized within enterprises and organizations
6+
7+
- How governance affects repository creation and ownership
8+
9+
- Why standardization is common in GHES environments
10+
11+
### Enterprise and organization structure
12+
13+
In GHES, repositories live inside organizations, which in turn are governed by an enterprise account. This hierarchy allows organizations to apply consistent policies across large numbers of repositories while still delegating day-to-day management to specific teams.
14+
15+
Enterprises typically use organizations to represent products, services, or business units. Access permissions, visibility settings, and inherited policies are applied at the organization level, which means that repository behavior is often shaped before a single line of code is written.
16+
17+
From a developer perspective, this structure means that repositories are rarely “personal” spaces. They are shared assets owned by teams and governed by enterprise-wide standards.
18+
19+
### Repository creation in governed environments
20+
21+
In many GHES deployments, repository creation is not open to all users. Organizations may restrict repository creation to organization owners or specific roles, ensuring that new repositories align with internal standards from the beginning.
22+
23+
When repositories are created, they often inherit predefined settings such as default branches, branch protection rules, issue tracking configuration, and automation hooks. Naming conventions may be enforced to make repositories easy to identify and manage at scale.
24+
25+
These controls reduce inconsistency and help enterprises maintain visibility and compliance across hundreds or thousands of repositories. For developers, this means that creating a repository is often a coordinated action rather than an individual choice.
26+
If you cannot create a repository directly, use your organization's established request path rather than creating workarounds or duplicating code in ungoverned locations.
27+
28+
### Roles, ownership, and repository lifecycle
29+
30+
Enterprise-managed environments often separate responsibilities. Developers contribute code, but organization owners or repository administrators may control repository creation, visibility, and policy configuration. This ensures repositories are created with the right ownership, access model, and baseline settings from day one.
31+
32+
Repository governance also includes lifecycle controls. In some situations, repositories may be locked to prevent further changes, or restored after accidental deletion. Understanding that repositories are managed assets-rather than personal workspaces-helps teams plan changes, request access through the right channels, and avoid work that conflicts with enterprise controls.
33+
34+
### Repository templates and standardization
35+
36+
To further support consistency, many organizations rely on repository templates. Templates provide a starting point that includes required documentation, configuration files, and default workflows. By using templates, teams avoid repetitive setup tasks and ensure that every repository meets baseline requirements for security, documentation, and automation.
37+
38+
Before creating a new repository on GHES, developers should check whether approved templates exist and follow organizational guidance. Using the correct template is often the fastest path to getting started.
39+
40+
### Step-by-step: Confirm you're in the right repository and understand its standards
41+
42+
If you are joining an existing project, start by verifying you're working in the correct organization and repository, and identify any standards the repository expects you to follow.
43+
44+
1. In the GHES web UI, navigate to the organization and repository you expect to use.
45+
1. Confirm the repository name and description match the project you intend to work on.
46+
1. Verify the default branch (commonly main) and whether the repository appears to be active.
47+
1. Review common standardization files if they exist:
48+
49+
- README (what the repo is and how to run it)
50+
- CONTRIBUTING (contribution workflow and review expectations)
51+
- CODEOWNERS (who must review changes to specific paths)
52+
- SECURITY (security reporting process)
53+
54+
1. If you use GitHub CLI, you can confirm basic repository details from the command line:
55+
56+
```bash
57+
gh repo view ORG/REPO --hostname github.company.com
58+
```
59+
60+
If you cannot access the repository, confirm your organization membership and repository permissions before troubleshooting Git or branch settings.
61+
62+
Key takeaway: On GHES, repositories are governed assets, so understanding the enterprise structure, following creation controls, and using approved templates helps you start work in a compliant and sustainable way.
63+
64+
Now that you understand where repositories live and how they are created in governed environments, you're ready to look at how work flows through branches in those repositories.
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
Branching strategies define how work flows from development into stable, production-ready code. On GHES, branching is not just a technical practice but a governance mechanism that helps enterprises manage risk and maintain control.
2+
3+
### In this unit, you'll learn
4+
5+
- How default branches are treated in enterprise repositories
6+
7+
- Common branching strategies used on GHES
8+
9+
- Why branch discipline is enforced
10+
11+
### Default branches and stability
12+
13+
Most GHES repositories designate a default branch, commonly named main. This branch typically represents the most stable and trusted version of the codebase. It may be used directly for deployments, releases, or downstream integrations.
14+
15+
Because of its importance, the default branch is rarely open for direct modification. Instead, changes are introduced through pull requests from short-lived branches. This approach ensures that every change is reviewed, tested, and recorded before it becomes part of the stable codebase.
16+
17+
### Common enterprise branching models
18+
19+
Enterprises often standardize on a small number of branching models to reduce confusion and improve consistency across teams. Trunk-based development is common, with developers creating short-lived branches and merging frequently into the default branch through pull requests. Some organizations use release branches to support parallel development and maintenance, particularly when supporting multiple versions of a product.
20+
21+
Regardless of the specific model, the key characteristic of enterprise branching on GHES is that branches exist to support controlled change, not experimentation without oversight.
22+
23+
### Why branch discipline matters
24+
25+
Strict branching rules help organizations reduce the risk of unreviewed or unstable changes reaching critical systems. They also support auditability by ensuring that every change has a documented history, including who authored it, who reviewed it, and which checks were applied.
26+
27+
For developers, this discipline can initially feel restrictive. Over time, however, it provides clarity and predictability, especially in large teams where uncontrolled branching quickly leads to confusion.
28+
29+
### Step-by-step: Create a feature branch and keep it up to date
30+
31+
Your organization may have specific naming conventions and rules, but this flow is a common baseline for working safely with a protected default branch.
32+
33+
1. Make sure your local default branch is up to date:
34+
35+
```bash
36+
37+
git checkout main
38+
39+
git fetch origin
40+
41+
git pull --ff-only
42+
43+
```
44+
45+
1. Create a short-lived feature branch:
46+
47+
```bash
48+
49+
git checkout -b feature/short-description
50+
51+
```
52+
53+
1. Make changes, then commit them:
54+
55+
```bash
56+
57+
git status
58+
59+
git add .
60+
61+
git commit -m "Describe the change"
62+
63+
```
64+
65+
1. Push the branch to GHES:
66+
67+
```bash
68+
69+
git push -u origin feature/short-description
70+
71+
```
72+
73+
1. If your branch falls behind, update it using the approach your team prefers:
74+
75+
- If your organization prefers rebase:
76+
77+
```bash
78+
79+
git fetch origin
80+
81+
git rebase origin/main
82+
83+
```
84+
85+
- If your organization prefers merge:
86+
87+
```bash
88+
89+
git fetch origin
90+
91+
git merge origin/main
92+
93+
```
94+
95+
Use the strategy your team standardizes on, since branch protection settings (and review expectations) often assume a particular workflow.
96+
97+
Key takeaway: Enterprise branching models on GHES are designed to keep the default branch stable and to ensure that changes move through controlled, reviewable paths.
98+
99+
With branching discipline in place, the next step is understanding how GHES enforces that discipline through branch protection rules and review requirements.

0 commit comments

Comments
 (0)