Connect to GitHub with SSH
The Pull Request Flow
A pull request (PR), called a *merge request* in GitLab, proposes merging your branch into another branch. It is where review, discussion and automated checks happen.
Forks
For open source you usually fork (copy) the repository to your account, push to your fork and open a PR to the original (called upstream).
A Good Pull Request
- Small: easier to review, faster to merge
- Clear title and description: what, why, how you tested
- Linked issue (
Closes #123) - Passing automated tests and linters
- Screenshots or logs when helpful
- Reviewers: be kind, specific and focus on correctness, security and clarity. Authors: respond to every comment
Branch Protection and CODEOWNERS
Protect main so nobody can break it by accident. In GitHub: Settings, Branches (or Rulesets).
- Require a pull request and at least one approval
- Require status checks (build, tests, security scan) to pass
- Require branches to be up to date and conversations resolved
- Block force-pushes and deletion
- Require signed commits or linear history if your team wants
Branching Strategies
| Strategy | How it works | Best for |
|---|---|---|
| GitHub Flow | main is always deployable. Short feature branches, PR, merge, deploy | Web apps with continuous deployment |
| Trunk-based development | Everyone merges small changes to main (trunk) at least daily. Unfinished work hides behind feature flags | High-performing teams with strong CI |
| Gitflow | Long-lived main and develop, plus feature, release and hotfix branches | Versioned products with scheduled releases |
| Environment branches | A branch per environment (dev, staging, prod) | Often discouraged. Prefer one branch and promote artifacts |
Semantic Versioning and Releases
Version releases as MAJOR.MINOR.PATCH, for example 2.4.1.
| Part | Increase when |
|---|---|
| MAJOR | Breaking change |
| MINOR | New backward compatible feature |
| PATCH | Backward compatible bug fix |
Git Hooks
Hooks are scripts that Git runs at certain moments, stored in .git/hooks/. Common ones: pre-commit (run before a commit is created), commit-msg (check the message) and pre-push.
Because .git/hooks is not shared, teams use the pre-commit framework to keep hooks in the repository:
rev values above are examples. Use the latest tags from each project when you set this up.
Signed Commits
Signing proves who made a commit. Use SSH signing, which is simple to set up:
Monorepo, Submodules and Large Files
- Monorepo: many projects in one repository. Easy sharing, needs smart CI that builds only what changed
- Submodules: include another repository at a fixed commit (
git submodule add). Powerful but easy to misuse - Git LFS: store large binary files outside normal history
- Shallow clone:
git clone --depth 1is faster in CI
Practice Tasks
- Fork a public repository, make a small change and open a pull request
- Enable branch protection on your own repo and prove that you cannot push directly to
main - Add
CODEOWNERSand a pull request template - Install
pre-commitwith a secret scanner and try to commit a fake key - Tag a release and generate release notes with the GitHub CLI
Conclusion
Teams collaborate through pull requests, protected branches, automated checks and a clear branching strategy. Keep branches short, protect main, and let hooks and CI catch mistakes before humans review.

