GitHub Best Practices Guide

Branch Naming Conventions

Branch Type Naming Convention Example
Feature feature/<name> feature/auth-ui
Bugfix fix/<name> fix/input-validation
Hotfix hotfix/<name> hotfix/payment-crash
Enhancement enhancement/<name> enhancement/performance-boost
Release release/<version> release/v1.2.0
Experiment experiment/<name> experiment/new-login-flow
Documentation docs/<name> docs/api-reference

Commit Message Structure

Type Emoji Prefix Example
Feature feat: ✨ feat(auth): add password reset page
Bugfix 🐛 fix: 🐛 fix(ui): resolve input field validation issue
Refactor ♻️ refactor: ♻️ refactor(signup): optimize form state handling
Performance perf: ⚡ perf(api): reduce database query time
Style 💄 style: 💄 style(button): improve hover effect
Documentation 📝 docs: 📝 docs(readme): update installation steps

Common Git Commands

Cloning a Repository

git clone <repo-url>

Creating a New Branch

git checkout -b feature/new-feature

Switching Branches

git checkout main

Staging and Committing Changes

git add .
git commit -m "✨ feat(ui): add new login page"

Pushing Changes

git push origin feature/new-feature

Fetching and Merging Updates

git fetch origin
git merge origin/main

Rebasing a Branch

git rebase main

Undoing the Last Commit

git reset --soft HEAD~1  # Keep changes
git reset --hard HEAD~1  # Remove changes

Releases and Tags

Creating a Tag for a Release

git tag -a v1.0.0 -m "Release version 1.0.0"

Pushing Tags to Remote

git push origin v1.0.0

Listing All Tags

git tag

Creating a GitHub Release

  1. Go to the repository on GitHub.
  2. Navigate to the Releases section.
  3. Click Draft a new release.
  4. Select the tag and add release notes.
  5. Click Publish Release.

General Best Practices