Appearance
🐙 GitHub & Version Control
GitHub is a web-based hosting service for Git repositories, providing a unified workspace map for revision tracking, peer-to-peer collaboration, code hosting, and automated CI/CD pipelines.
📊 Tool Datasheet
| Metric | Details |
|---|---|
| Tool Name | Git & GitHub |
| Category | Distributed Version Control & Collaboration Platform |
| Purpose | Code history management, staging environments, code review pipelines, and automated application releases. |
| License | Open Source (Git), Commercial/Free Tier hosted platform (GitHub) |
| Core Clients | Git CLI, GitHub Desktop, VS Code Git extension |
🛠️ Capabilities
- Branching & Merging: Safe isolation of development tasks via feature branches, allowing concurrent modifications without corrupting the main codebase.
- Pull Requests & Reviews: Peer-to-peer code reviews, inline comments, and automated security checks before merging code into main branches.
- GitHub Actions: Build, test, and deploy applications automatically on specific triggers (push, pull request, cron schedules).
- Issue Tracking & Project Management: Organize feature requests, bug logs, and milestones directly alongside source repository code.
- Secure Secret Management: Store database passwords, API keys, and server credentials securely using GitHub Secrets for CI/CD builds.
🧭 Step-by-Step Tutorial & Setup
This tutorial guides you through setting up a local repository, branching, committing changes, and configuring a basic automated test suite on GitHub.
1. Global Git Configuration
Configure your development credentials on your local system:
bash
git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"
git config --global init.defaultBranch main2. Initialize a Local Repository
Initialize version tracking inside your local project workspace:
bash
cd ~/AI_BOOTCAMP/labs/my-project
git initCreate a .gitignore file to prevent committing cache and credentials files:
text
# .gitignore
.env
__pycache__/
*.pyc
.conda/
miniconda3/
node_modules/
dist/3. Stage & Commit Code
Stage all project workspace files and commit them to establish a codebase baseline:
bash
git add .
git commit -m "feat: initial commit with project scaffold and environment configuration"4. Configure GitHub Action Pipeline (CI/CD)
Configure a basic automated workflow that runs your pytest suites every time you push code to GitHub.
Create a file at .github/workflows/python-tests.yml:
yaml
name: Python Application CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install uv & Dependencies
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
uv pip install --system pytest httpx pydantic
- name: Run Tests
run: |
pytest tests/💡 Sample Ideation to Test
To test version control workflows, try setting up these pipeline scenarios:
- Enforce Pre-Commit hooks: Install
pre-commitlocally to run formatting tools (likeblackorruff) automatically before allowing a git commit. - Pull Request Gates: Set up branch protection rules on your GitHub repository to require at least one code approval and a passing GitHub Actions status before allowing code to merge into
main.