Skip to content

Git Workflow Guide for Solo Developers

Branching, Pull Requests & CodeRabbit Integration


Inhaltsverzeichnis

  1. Warum Branching als Solo Developer?
  2. Branch-Strategie für Solo-Projekte
  3. Branch Naming Conventions
  4. Commit Message Best Practices
  5. Pull Request Workflow
  6. CodeRabbit Setup & Nutzung
  7. GitHub Actions Integration
  8. Praktische Workflows
  9. Git Commands Cheat Sheet
  10. Troubleshooting

Warum Branching als Solo Developer?

Vorteile auch ohne Team

❌ Häufige Fehlannahme:
"Ich arbeite alleine, ich brauche keine Branches."

✅ Realität:
Branches sind auch für Solo-Developer wertvoll!

Gründe für Branching im Solo-Projekt:

  1. 🔒 Sicherheit: Master/Main bleibt immer funktionsfähig
  2. 📝 Dokumentation: PRs dokumentieren WARUM Änderungen gemacht wurden
  3. 🤖 Code Review: CodeRabbit reviewed automatisch deinen Code
  4. ✅ Testing: CI/CD läuft auf PRs bevor merge
  5. 🔄 Rollback: Einfaches Zurückrollen bei Problemen
  6. 🎯 Fokus: Jeder Branch = Eine logische Änderung
  7. 📊 History: Klare Historie was wann geändert wurde

Beispiel-Szenario

# ❌ Direkt auf main - Gefährlich!
git checkout main
# Schreibe Code...
git add .
git commit -m "stuff"  # Unklar was geändert wurde
git push

# Wenn etwas kaputt ist → main ist broken!
# Schwer zu debuggen welche Änderung das Problem verursacht

# ✅ Mit Branch - Sicher!
git checkout -b feature/add-export-function
# Schreibe Code...
git add .
git commit -m "feat: add CSV export functionality"
git push -u origin feature/add-export-function

# PR erstellen → CodeRabbit reviewed
# Tests laufen → Alles grün
# Merge → main bleibt sauber

Branch-Strategie für Solo-Projekte

Simplified Git Flow (Empfohlen für Solo)

main (protected)
  └── feature/add-user-auth
  └── fix/memory-leak
  └── docs/update-readme
  └── refactor/cleanup-models

Regeln: - ✅ main: Immer deployable/funktionsfähig - ✅ Feature branches: Kurzlebig, eine Änderung pro Branch - ✅ Direkte Merges: Keine komplexen Merge-Strategien - ✅ Delete after merge: Branches werden nach PR gelöscht

Branch-Typen

# Feature: Neue Funktionalität
feature/user-authentication
feature/csv-export
feature/dark-mode

# Fix: Bug-Behebung
fix/memory-leak-in-worker
fix/crash-on-startup
fix/validation-error

# Docs: Dokumentation
docs/update-readme
docs/add-api-examples
docs/installation-guide

# Refactor: Code-Verbesserung (keine neue Funktionalität)
refactor/cleanup-constants
refactor/extract-business-logic
refactor/improve-performance

# Test: Nur Tests hinzufügen
test/add-unit-tests-for-models
test/integration-test-api

# Chore: Build, Dependencies, Tools
chore/update-dependencies
chore/setup-github-actions
chore/configure-linters

Alternative: Trunk-Based Development (Minimal)

Für sehr kleine Projekte:

main
  └── [kurze Feature-Branches, <1 Tag]

Wann verwenden: - Projekt ist sehr klein (<5000 LOC) - Änderungen sind klein und häufig - Du willst maximale Einfachheit


Branch Naming Conventions

Format

<type>/<short-description>

Examples:
feature/user-login
fix/database-connection
docs/api-documentation
refactor/signal-handling
test/memory-leak-detection

Rules

# ✅ GOOD - Clear and descriptive
feature/add-export-to-csv
fix/resolve-memory-leak-in-worker
docs/update-installation-guide
refactor/extract-validation-logic

# ❌ BAD - Too vague
feature/stuff
fix/bug
docs/update
refactor/changes

# ❌ BAD - Too long
feature/add-the-ability-to-export-data-to-csv-and-also-excel-files

# ❌ BAD - Special characters
feature/add_export  # Use hyphens, not underscores
fix/bug#123        # No special chars except hyphens

Präfix-Übersicht

Präfix Verwendung Beispiel
feature/ Neue Funktionalität feature/user-authentication
fix/ Bug-Behebung fix/memory-leak
docs/ Dokumentation docs/update-readme
refactor/ Code-Verbesserung refactor/cleanup-models
test/ Tests hinzufügen test/unit-tests-models
chore/ Build/Tools chore/update-deps
perf/ Performance perf/optimize-queries
style/ Formatting style/apply-black

Commit Message Best Practices

Conventional Commits Format

<type>(<scope>): <subject>

<body>

<footer>

Types

feat:     Neue Funktionalität
fix:      Bug-Behebung
docs:     Dokumentation
refactor: Code-Verbesserung (keine neue Funktionalität)
test:     Tests hinzufügen/ändern
chore:    Build, Dependencies, Tools
perf:     Performance-Verbesserung
style:    Formatierung (keine Code-Änderung)
ci:       CI/CD Änderungen

Examples

# ✅ GOOD - Clear and specific
git commit -m "feat(auth): add user login with JWT tokens

- Implement JWT token generation
- Add login endpoint
- Add authentication middleware
- Add tests for login flow

Closes #42"

# ✅ GOOD - Simple fix
git commit -m "fix(models): resolve memory leak in DataModel

Worker threads were not properly cleaned up.
Added deleteLater() calls in cleanup method."

# ✅ GOOD - Documentation
git commit -m "docs(readme): add installation instructions

Added step-by-step installation guide for:
- Windows
- macOS
- Linux"

# ❌ BAD - Too vague
git commit -m "fixed stuff"
git commit -m "update"
git commit -m "changes"

# ❌ BAD - Multiple unrelated changes
git commit -m "Add login, fix bug, update docs, refactor models"
# → Should be 4 separate commits!

Commit Message Template

# .gitmessage
# <type>(<scope>): <subject>
#
# <body>
#
# <footer>

# Type: feat, fix, docs, refactor, test, chore, perf, style, ci
# Scope: Component affected (auth, models, ui, api)
# Subject: Imperative mood ("add" not "added", max 50 chars)
#
# Body: Explain WHAT and WHY (not HOW)
#       Wrap at 72 characters
#
# Footer: Issue references (Closes #123, Fixes #456)
#         Breaking changes (BREAKING CHANGE: description)

# Configure Git to use this template:
# git config commit.template .gitmessage

Setting up the Template

# Create template file
cat > .gitmessage << 'EOF'
# <type>(<scope>): <subject>
#
# <body>
#
# <footer>
#
# Type: feat, fix, docs, refactor, test, chore, perf, style, ci
# Subject: Max 50 chars, imperative mood
# Body: Wrap at 72 chars
EOF

# Configure Git
git config commit.template .gitmessage

Pull Request Workflow

Basic Workflow

# 1. Create branch
git checkout main
git pull origin main
git checkout -b feature/add-csv-export

# 2. Make changes
# ... code code code ...

# 3. Commit changes
git add .
git commit -m "feat(export): add CSV export functionality"

# 4. Push to GitHub
git push -u origin feature/add-csv-export

# 5. Create Pull Request on GitHub
# → CodeRabbit automatically reviews
# → CI/CD runs tests
# → Review & Merge

# 6. Cleanup
git checkout main
git pull origin main
git branch -d feature/add-csv-export

PR Template

Create .github/PULL_REQUEST_TEMPLATE.md:

## Description

<!-- Describe your changes in detail -->

## Type of Change

<!-- Mark with an 'x' -->

- [ ] 🐛 Bug fix (non-breaking change which fixes an issue)
- [ ] ✨ New feature (non-breaking change which adds functionality)
- [ ] 💥 Breaking change (fix or feature that would cause existing functionality to change)
- [ ] 📝 Documentation update
- [ ] 🔨 Refactoring
- [ ] 🧪 Test update

## Motivation and Context

<!-- Why is this change required? What problem does it solve? -->
<!-- If it fixes an open issue, please link to the issue here. -->

Closes #(issue)

## How Has This Been Tested?

<!-- Please describe how you tested your changes. -->
<!-- Include details of your testing environment, and the tests you ran. -->

- [ ] Manual testing
- [ ] Unit tests
- [ ] Integration tests

## Screenshots (if appropriate)

<!-- Add screenshots to help explain your changes -->

## Checklist

<!-- Mark with an 'x' when complete -->

- [ ] My code follows the project's style guidelines
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged and published

## Additional Notes

<!-- Any additional information that reviewers should know -->

PR Best Practices

# ✅ GOOD PR - Clear and focused

Title: feat(export): Add CSV export functionality

Description:
Implements CSV export for project data.

**Changes:**
- Added CSVExporter class with pandas backend
- Added export action to File menu
- Added tests for CSV generation
- Updated documentation

**Testing:**
- Tested with 1000+ item projects
- Verified encoding (UTF-8)
- Checked Excel compatibility

Closes #42

# ❌ BAD PR - Vague and unfocused

Title: Updates

Description:
Fixed some stuff and added things.

Changes:
- Various updates
- Some fixes
- Added features

CodeRabbit Setup & Nutzung

Was ist CodeRabbit?

CodeRabbit ist ein AI-powered Code Review Tool, das automatisch: - ✅ Code reviewed (Best Practices, Bugs, Performance) - ✅ Verbesserungsvorschläge macht - ✅ Fragen zum Code beantwortet - ✅ Dokumentation prüft - ✅ Tests vorschlägt

Setup

1. GitHub App installieren:

https://github.com/apps/coderabbitai
→ Install auf deinem Repository

2. Configuration File erstellen:

.coderabbit.yaml im Repository-Root:

# CodeRabbit Configuration

# Language settings
language: en-US

# Review settings
reviews:
  # Auto-review every PR
  auto_review:
    enabled: true

  # Review scope
  scope:
    - "**/*.py"      # All Python files
    - "**/*.md"      # Documentation
    - "!tests/**"    # Exclude test files (optional)

  # Review focus areas
  focus:
    - code_quality
    - security
    - performance
    - documentation
    - testing
    - best_practices

# Python-specific settings
python:
  version: "3.11"
  style_guide: "pep8"
  type_checking: true

  # Project-specific rules
  custom_rules:
    - "Follow Google-style docstrings"
    - "Use type hints on all functions"
    - "Follow project's constants management (see constants_management_guide.md)"
    - "Use Enums instead of string constants"
    - "Follow PySide6 Signal/Slot best practices"

# Documentation
documentation:
  check_docstrings: true
  check_comments: true
  suggest_improvements: true

# Testing
testing:
  suggest_tests: true
  check_coverage: false  # If you have coverage tool

# Chat/Questions
chat:
  enabled: true

# Notifications
notifications:
  # Comment on PR when review is done
  pr_comments: true

Verwendung in PRs

1. PR erstellen → CodeRabbit startet automatisch

git push -u origin feature/add-export

# Auf GitHub: Create Pull Request
# → CodeRabbit kommentiert innerhalb 1-2 Minuten

2. CodeRabbit Review lesen

CodeRabbit kommentiert:

## CodeRabbit Review

### Summary
Overall good implementation! Found 3 suggestions for improvement.

### 🔴 Critical Issues (0)
None

### 🟡 Suggestions (3)

#### File: src/myapp/models/exporter.py
**Line 45:** Missing type hint on return value
```python
# Current:
def export_data(self, data):

# Suggested:
def export_data(self, data: List[str]) -> bool:

File: src/myapp/models/exporter.py

Line 67: Consider using Enum instead of string constant

# Current:
format = "csv"

# Suggested:
from myapp.enums import ExportFormat
format = ExportFormat.CSV

💬 Questions

  1. Should export handle empty data gracefully?
  2. What's the expected behavior for special characters?

✅ Good Practices

  • Proper error handling
  • Good test coverage
  • Clear documentation
    **3. Mit CodeRabbit chatten**
    
    ```markdown
    # In PR-Kommentar:
    @coderabbitai Sollte ich hier ein Enum verwenden?
    
    # CodeRabbit antwortet:
    Yes! Based on your project's constants_management_guide.md, 
    you should use Enums for type-safe values. Here's how:
    
    [Code-Beispiel]
    

4. Änderungen einarbeiten

# Änderungen basierend auf Review machen
git add .
git commit -m "refactor: apply CodeRabbit suggestions

- Add type hints to export_data
- Use ExportFormat enum instead of strings
- Add empty data validation"

git push

# CodeRabbit reviewed automatisch den neuen Code

CodeRabbit Commands

Im PR-Kommentar:

# Code Review
@coderabbitai review        # Re-review the entire PR
@coderabbitai review <file> # Review specific file

# Questions
@coderabbitai explain this function
@coderabbitai how can I improve this?
@coderabbitai suggest tests for this

# Generate
@coderabbitai generate tests for this function
@coderabbitai suggest improvements

# Documentation
@coderabbitai add docstring
@coderabbitai explain this code

# Configuration
@coderabbitai pause reviews  # Pause for this PR
@coderabbitai resume reviews

Best Practices mit CodeRabbit

# ✅ GOOD - Small, focused PRs
PR: Add CSV export
Files changed: 3
Lines: +150, -0

→ CodeRabbit kann gut reviewen

# ❌ BAD - Massive PR
PR: Refactor entire codebase
Files changed: 47
Lines: +5000, -3000

→ CodeRabbit Review wird oberflächlich
→ Besser: In kleinere PRs aufteilen

GitHub Actions Integration

Automatische Tests auf PRs

.github/workflows/pr-checks.yml:

name: PR Checks

on:
  pull_request:
    branches: [ main ]

jobs:
  code-quality:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v3

      - name: Set up Python
        uses: actions/setup-python@v4
        with:
          python-version: '3.11'

      - name: Install dependencies
        run: |
          pip install -e ".[dev]"

      - name: Format check (Black)
        run: |
          black --check src/ tests/

      - name: Lint (Ruff)
        run: |
          ruff check src/ tests/

      - name: Type check (MyPy)
        run: |
          mypy src/

      - name: Run tests
        run: |
          pytest -m critical --maxfail=1 -v

      - name: Check docstring coverage
        run: |
          interrogate src/ --fail-under=80

  security:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v3

      - name: Security scan
        uses: pypa/gh-action-pip-audit@v1.0.0

Auto-merge bei Success

.github/workflows/auto-merge.yml:

name: Auto Merge

on:
  pull_request:
    types: [ labeled ]

jobs:
  auto-merge:
    runs-on: ubuntu-latest
    if: contains(github.event.pull_request.labels.*.name, 'auto-merge')

    steps:
      - name: Auto merge
        uses: pascalgn/automerge-action@v0.15.6
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          MERGE_LABELS: "auto-merge"
          MERGE_METHOD: "squash"
          MERGE_COMMIT_MESSAGE: "pull-request-title"

Verwendung:

# Label "auto-merge" auf PR setzen
# → Merged automatisch wenn alle Checks grün sind


Praktische Workflows

Workflow 1: Feature Development

# 1. Start
git checkout main
git pull origin main
git checkout -b feature/user-authentication

# 2. Develop
# ... code code code ...

# 3. Commit (mehrmals während development)
git add src/myapp/auth/
git commit -m "feat(auth): add JWT token generation"

git add tests/test_auth.py
git commit -m "test(auth): add tests for token generation"

git add docs/auth.md
git commit -m "docs(auth): add authentication documentation"

# 4. Push
git push -u origin feature/user-authentication

# 5. Create PR on GitHub
# → CodeRabbit reviews
# → CI runs
# → Review suggestions

# 6. Apply feedback
git add .
git commit -m "refactor(auth): apply CodeRabbit suggestions"
git push

# 7. Merge PR on GitHub
# → Squash commits (optional)
# → Delete branch automatically

# 8. Cleanup local
git checkout main
git pull origin main
git branch -d feature/user-authentication

Workflow 2: Quick Fix

# 1. Create branch
git checkout -b fix/validation-error

# 2. Fix the bug
# ... fix ...

# 3. Commit
git add .
git commit -m "fix(validation): handle empty string in email validator

Previously crashed on empty string input.
Now returns False with proper error message.

Fixes #123"

# 4. Push & PR
git push -u origin fix/validation-error

# 5. Quick review & merge
# → If urgent: merge immediately after CI passes
# → Otherwise: wait for CodeRabbit review

Workflow 3: Documentation Update

# 1. Branch
git checkout -b docs/update-readme

# 2. Update docs
# ... edit README.md ...

# 3. Commit
git commit -am "docs(readme): update installation instructions

Added troubleshooting section for common issues."

# 4. Push & quick merge
git push -u origin docs/update-readme
# → Create PR
# → Usually merge quickly (no code changes)

Workflow 4: Refactoring

# 1. Branch
git checkout -b refactor/extract-constants

# 2. Refactor in small steps
git add constants/
git commit -m "refactor: create constants package structure"

git add src/myapp/models/
git commit -m "refactor(models): use constants instead of magic numbers"

git add tests/
git commit -m "test: update tests to use constants"

# 3. Push
git push -u origin refactor/extract-constants

# 4. PR with detailed description
# → Explain WHY refactoring
# → Show before/after examples
# → CodeRabbit ensures no functionality changed

Git Commands Cheat Sheet

Branch Management

# Create new branch
git checkout -b feature/my-feature

# Switch to existing branch
git checkout main

# List all branches
git branch -a

# Delete local branch
git branch -d feature/my-feature
git branch -D feature/my-feature  # Force delete

# Delete remote branch
git push origin --delete feature/my-feature

# Rename current branch
git branch -m new-name

# Update branch from main
git checkout feature/my-feature
git rebase main
# or
git merge main

Commits

# Stage changes
git add <file>           # Single file
git add .                # All files
git add -p               # Interactive staging

# Commit
git commit -m "message"
git commit -am "message"  # Add + commit (tracked files only)

# Amend last commit
git commit --amend
git commit --amend --no-edit  # Keep message

# Undo last commit (keep changes)
git reset HEAD~1

# Undo last commit (discard changes)
git reset --hard HEAD~1

Syncing

# Fetch changes
git fetch origin

# Pull changes
git pull origin main
git pull --rebase origin main  # Rebase instead of merge

# Push changes
git push origin feature/my-feature
git push -u origin feature/my-feature  # Set upstream
git push --force-with-lease  # Safe force push

Stashing

# Stash changes
git stash
git stash save "work in progress"

# List stashes
git stash list

# Apply stash
git stash apply
git stash pop  # Apply and remove

# Drop stash
git stash drop
git stash clear  # Remove all

Viewing History

# View log
git log
git log --oneline
git log --graph --oneline --all

# View changes
git diff
git diff main...feature/my-feature
git show <commit-hash>

# Blame (who changed what)
git blame <file>

Undoing Changes

# Discard changes in file
git checkout -- <file>
git restore <file>

# Unstage file
git reset HEAD <file>
git restore --staged <file>

# Revert commit (creates new commit)
git revert <commit-hash>

# Reset to specific commit
git reset --hard <commit-hash>  # DANGEROUS!

Troubleshooting

Problem: Merge Conflicts

# Conflict occurred during merge/rebase
# CONFLICT (content): Merge conflict in src/myapp/models.py

# 1. Open file, resolve conflicts
# File will have markers:
<<<<<<< HEAD
your changes
=======
incoming changes
>>>>>>> feature/my-feature

# 2. Edit to keep what you want, remove markers

# 3. Stage resolved files
git add src/myapp/models.py

# 4. Continue
git rebase --continue
# or
git merge --continue
# or
git commit

Problem: Forgot to create branch

# You made changes on main by accident!

# 1. Create branch from current state
git checkout -b feature/my-feature

# 2. Now main doesn't have your changes
# and feature/my-feature does

Problem: Need to switch branch with uncommitted changes

# Option 1: Stash
git stash
git checkout other-branch
# ... do work ...
git checkout original-branch
git stash pop

# Option 2: Commit to temporary commit
git commit -am "WIP: temporary commit"
git checkout other-branch
# ... do work ...
git checkout original-branch
git reset HEAD~1  # Undo WIP commit

Problem: Pushed wrong commit

# If you haven't pushed yet:
git reset HEAD~1

# If you already pushed (and it's only you):
git reset HEAD~1
git push --force-with-lease

# If someone else might have pulled:
git revert <commit-hash>  # Creates new commit that undoes
git push

Problem: Need to update PR after review

# Just commit and push to same branch
git add .
git commit -m "refactor: apply review feedback"
git push

# PR updates automatically!
# CodeRabbit reviews the new changes

Problem: Branch diverged from main

# Update your branch with main's changes

# Option 1: Merge (keeps all commits)
git checkout feature/my-feature
git merge main
git push

# Option 2: Rebase (cleaner history)
git checkout feature/my-feature
git rebase main
git push --force-with-lease  # Required after rebase

GitHub Repository Settings

Branch Protection Rules

Settings → Branches → Add rule

Branch name pattern: main

Protection rules:
✅ Require a pull request before merging
  ✅ Require approvals: 0  # Solo developer
  ✅ Dismiss stale pull request approvals when new commits are pushed
  ✅ Require review from Code Owners: 

✅ Require status checks to pass before merging
  ✅ Require branches to be up to date before merging
  Status checks: 
    - code-quality
    - security

✅ Require conversation resolution before merging

✅ Require linear history (no merge commits)

✅ Include administrators  # Even you must follow rules!

✅ Allow force pushes: 
✅ Allow deletions: 

Auto-delete Branches

Settings → General → Pull Requests

✅ Automatically delete head branches

Default Branch

Settings → General → Default branch

Default: main


Best Practices Summary

✅ DO

# ✅ Create branch for every change
git checkout -b feature/my-feature

# ✅ Use descriptive branch names
feature/add-csv-export
fix/memory-leak-worker

# ✅ Write good commit messages
git commit -m "feat(export): add CSV export with pandas backend"

# ✅ Keep PRs small and focused
# One feature per PR

# ✅ Use PR template
# Fill out all sections

# ✅ Review CodeRabbit suggestions
# Learn from AI feedback

# ✅ Run tests before PR
pytest -m critical

# ✅ Update from main regularly
git merge main

# ✅ Delete branches after merge
git branch -d feature/my-feature

❌ DON'T

# ❌ Work directly on main
git checkout main  # Then make changes

# ❌ Vague branch names
git checkout -b stuff
git checkout -b test

# ❌ Vague commit messages
git commit -m "update"
git commit -m "fixes"

# ❌ Massive PRs
# 50 files changed, 5000 lines

# ❌ Skip PR process
git push origin main  # Direct push

# ❌ Ignore CodeRabbit
# Just merge without reading

# ❌ Leave old branches
# Dozens of merged branches lying around

Daily Workflow Example

Morning

# 1. Update main
git checkout main
git pull origin main

# 2. Check what to work on
# Look at GitHub Issues or todo list

# 3. Create branch
git checkout -b feature/add-settings-dialog

# 4. Start coding
code .

During the Day

# Commit regularly (logical checkpoints)
git add src/myapp/ui/settings_dialog.py
git commit -m "feat(ui): add settings dialog structure"

# ... more work ...

git add src/myapp/ui/settings_dialog.py
git commit -m "feat(ui): implement settings persistence"

# ... more work ...

git add tests/test_settings.py
git commit -m "test(ui): add tests for settings dialog"

# Push to backup work
git push -u origin feature/add-settings-dialog

End of Day (or when feature done)

# 1. Final push
git push

# 2. Create PR on GitHub
# - Fill out template
# - Reference any issues
# - Add screenshots if UI changes

# 3. Wait for CodeRabbit review (1-2 min)

# 4. Review feedback
# - Address critical issues immediately
# - Make note of suggestions for later

# 5. If all green: Merge
# 6. Delete branch (automatically on GitHub)

# 7. Cleanup local
git checkout main
git pull origin main
git branch -d feature/add-settings-dialog

Tools & Aliases

Git Aliases

Add to ~/.gitconfig:

[alias]
  # Shortcuts
  co = checkout
  br = branch
  ci = commit
  st = status

  # Useful commands
  lg = log --graph --oneline --all --decorate
  last = log -1 HEAD
  unstage = reset HEAD --
  undo = reset --soft HEAD~1

  # Branch management
  branches = branch -a
  cleanup = !git branch --merged | grep -v '\\*' | xargs -n 1 git branch -d

  # Pretty log
  hist = log --pretty=format:'%h %ad | %s%d [%an]' --graph --date=short

Usage:

git co main          # Checkout main
git br               # List branches
git lg               # Pretty log
git cleanup          # Delete merged branches

VS Code Git Integration

Extensions: - GitLens (gitlens.gitlens) - Git Graph (mhutchie.git-graph) - GitHub Pull Requests (GitHub.vscode-pull-request-github)

Settings.json:

{
  "git.autofetch": true,
  "git.confirmSync": false,
  "git.enableSmartCommit": true,
  "gitlens.currentLine.enabled": true,
  "gitlens.hovers.currentLine.over": "line"
}

GitHub CLI

# Install
# https://cli.github.com/

# Create PR from command line
gh pr create --title "feat: Add export" --body "Implements CSV export"

# List PRs
gh pr list

# Check PR status
gh pr status

# Merge PR
gh pr merge 123 --squash

# View PR in browser
gh pr view 123 --web

Summary Checklist

For Every Feature

- [ ] Create descriptive branch name (feature/fix/docs/etc.)
- [ ] Make focused commits with good messages
- [ ] Write/update tests
- [ ] Update documentation
- [ ] Run local checks (black, ruff, mypy, pytest)
- [ ] Push to GitHub
- [ ] Create PR with template filled out
- [ ] Review CodeRabbit feedback
- [ ] Address critical issues
- [ ] Wait for CI to pass
- [ ] Merge when ready
- [ ] Delete branch
- [ ] Pull main locally

PR Checklist

- [ ] PR has clear title (follows conventional commits)
- [ ] Description explains WHAT and WHY
- [ ] Template is completely filled out
- [ ] All CI checks passing
- [ ] CodeRabbit reviewed (no critical issues)
- [ ] Commits are clean (or will be squashed)
- [ ] No merge conflicts
- [ ] Ready to merge!

Quick Reference Card

┌─────────────────────────────────────────────────────────────┐
│                    SOLO DEVELOPER GIT FLOW                   │
├─────────────────────────────────────────────────────────────┤
│                                                               │
│  1. Start: git checkout main && git pull                     │
│  2. Branch: git checkout -b feature/my-feature               │
│  3. Code: ... make changes ...                               │
│  4. Commit: git commit -am "feat: description"               │
│  5. Push: git push -u origin feature/my-feature              │
│  6. PR: Create on GitHub                                     │
│  7. Review: CodeRabbit + CI                                  │
│  8. Merge: Squash & merge                                    │
│  9. Cleanup: Delete branch, pull main                        │
│                                                               │
│  Branch Format: <type>/<description>                         │
│  Commit Format: <type>(<scope>): <subject>                   │
│                                                               │
│  Main always deployable!                                     │
│  Small PRs are better!                                       │
│  Let CodeRabbit help you improve!                            │
│                                                               │
└─────────────────────────────────────────────────────────────┘

Happy Coding! 🚀

Remember: Even as a solo developer, good Git practices save you time and headaches. Use branches, write good commits, create PRs, and let CodeRabbit help you write better code!