GitHub 101
A comprehensive guide to version control and collaborative development with GitHub. Learn Git fundamentals, GitHub workflows, and best practices for open-source development.
Git vs GitHub: Understanding the Difference
Learn the key differences between Git (the version control system) and GitHub (the collaborative platform) to master both tools effectively.
๐ง Git
Version Control System- Runs locally on your computer
- Tracks changes in your files
- Creates snapshots (commits) of your code
- Manages different versions and branches
- Works offline
- Command-line tool
GitHub
Collaborative Platform- Hosts your Git repositories online
- Enables collaboration with teams
- Provides web interface for Git
- Offers pull requests and code review
- Includes issue tracking and project management
- Available anywhere with internet connection
๐ Think of it this way:
Git is like a powerful filing system for your documents that tracks every change you make. GitHub is like Google Drive - it stores your filing system in the cloud and lets you share it with others.
Version Control
Track every change to your code with precision. Never lose work or wonder "what broke" again.
Collaboration
Work seamlessly with teams of any size. Review code, discuss changes, and merge contributions effortlessly.
Deployment
Automate testing and deployment with GitHub Actions. Ship reliable code faster than ever.
Code Discovery
Explore millions of open-source projects. Learn from the best and contribute to the community.
Edit
Make changes
Stage
Prepare commits
Commit
Save snapshot
Push
Share changes
๐ Version Control in Action
Here's how version control works in practice with a real PowerShell script example:
Initial Version
Started with a basic PowerShell script
# Get-SystemInfo.ps1 - Initial version
Write-Host "Hello, World!"
Added Error Handling
Enhanced with try-catch blocks for reliability
# Added error handling
try {
Write-Host "Hello, World!" -ForegroundColor Green
# More functionality here
}
catch {
Write-Error "Something went wrong: $_"
}
Performance & Best Practices
Applied PowerShell best practices and optimization
# Performance improvements
[CmdletBinding()]
param()
try {
Write-Host "Hello, World!" -ForegroundColor Green
# Optimized code with better practices
Write-Verbose "Script completed successfully"
}
catch {
Write-Error "Something went wrong: $_"
exit 1
}
๐ฏ Why This Matters
- Track Changes: See exactly what changed between versions
- Collaborate Safely: Multiple developers can work without conflicts
- Roll Back: Return to any previous working version instantly
- Branch Development: Work on features without breaking main code
Quick Check
What is the main benefit of version control?
Setting Up Git & GitHub
๐ ๏ธ Complete Setup Guide
Choose your preferred workflow - you can use one or all of these tools together:
๐ง Essential Setup (Required)
Access GitHub
๐ Setup Steps
- Create GitHub Account: Sign up at github.com (free account)
- Verify Email: Check your email and verify your GitHub account
- Setup Profile: Add your name, bio, and profile picture
- Enable 2FA: Set up two-factor authentication for security
- Explore GitHub: Take a look around the GitHub interface
๐ What you get with GitHub (Free Account):
- Unlimited public repositories
- Unlimited private repositories
- GitHub Actions (2000 minutes/month free)
- GitHub Packages (500 MB free storage)
- Community support and documentation
- Basic security features and dependency alerts
- Integration with thousands of development tools
Install Git
- Download Git from git-scm.com/downloads
- Choose your operating system (Windows, macOS, or Linux)
- Run the installer and follow the setup wizard
Verify Installation:
# Open terminal/command prompt and test
git --version
# Should show: git version 2.42.0 or similar
Configure Git Identity
Set up your identity for commits:
# Set your name and email (required)
git config --global user.name "Norman Borlaug"
git config --global user.email "nborlaug@ag.tamu.edu"
# Optional: Set default branch name
git config --global init.defaultBranch main
# Optional: Improve Windows performance
git config --global core.preloadindex true
git config --global core.fscache true
git config --global gc.auto 256
๐ก Configuration Explanation:
- user.name & user.email: Appears in every commit you make
- init.defaultBranch: Sets default branch name to 'main' (modern standard)
- Windows optimizations: Improves Git performance on Windows systems
Setup Authentication
Choose one method to authenticate with GitHub:
Test Your Setup
Let's verify everything works with a test repository:
๐งช Complete Workflow Test
# 1. Create a test directory
mkdir my-first-repo
cd my-first-repo
# 2. Initialize Git repository
git init
# 3. Create a README file
echo "# My First Repository" > README.md
echo "This is a test repository to verify my Git setup." >> README.md
# 4. Add and commit
git add README.md
git commit -m "Initial commit: Add README"
# 5. Create repository on GitHub (via web interface)
# - Go to github.com, click "+" โ "New repository"
# - Name it "my-first-repo", keep it public
# - Don't initialize with README (we already have one)
# 6. Connect local repo to GitHub
git remote add origin git@github.com:YOUR_USERNAME/my-first-repo.git
# OR if using HTTPS: git remote add origin https://github.com/YOUR_USERNAME/my-first-repo.git
# 7. Push to GitHub
git branch -M main
git push -u origin main
โ Success Indicators:
- No authentication errors when pushing
- Repository appears on your GitHub profile
- README.md is visible on GitHub
- Commit history shows your name and email
๐ง Common Issues:
- Permission denied: Check SSH key or token setup
- Wrong author: Verify git config user.name and user.email
- Remote exists: Repository might already exist on GitHub
๐จ GitHub Desktop (Visual Git Interface)
โจ Why GitHub Desktop?
- Visual Interface: See changes, branches, and history graphically
- Beginner Friendly: No command line knowledge required
- Windows Integration: Native Windows application
- GitHub Integration: Built-in pull request and issue management
- Conflict Resolution: Visual merge conflict resolution
๐ธ GitHub Desktop Interface
- Repository list
- Branch visualization
- Commit history
- File diff viewer
Download and Install
- Download GitHub Desktop or use Git command line
- Run
GitHubDesktopSetup-x64.exe - GitHub Desktop will automatically install and update
- No additional configuration needed - it uses your system Git installation
Sign In and Configure
- Launch GitHub Desktop
- Sign in with your GitHub account
- Choose your name and email (should match your Git config)
- Select repositories to clone or create new ones
๐ Typical GitHub Desktop Workflow:
Key Features for Windows Engineers
Repository Management
Clone, create, and switch between repositories with ease
Branch Visualization
See branch relationships and history graphically
๐ Commit History
Browse commits with file changes and diff viewing
๐ Merge Conflicts
Resolve conflicts with built-in merge tools
๐ Pull Requests
Create and manage pull requests directly from Desktop
๐ File Changes
See exactly what changed in your PowerShell/Python files
๐ป VS Code + GitHub Integration
๐ Why VS Code + GitHub?
- Integrated Workflow: Edit, commit, and push without leaving your editor
- PowerShell Support: Excellent PowerShell extension with debugging
- Python Support: Built-in Python support with linting and debugging
- GitHub Features: Pull requests, issues, and codespaces integration
- Extensions: Massive ecosystem for Windows development
Install VS Code
- Download from code.visualstudio.com
- Run the installer (choose "User Installer" for single user)
- Important: Check "Add to PATH" during installation
- VS Code automatically detects your Git installation
Install Essential Extensions
๐ง GitHub Extension Pack
Extension ID: GitHub.vscode-github-extension-pack
Includes: GitHub Pull Requests, GitHub Repositories, GitHub Codespaces
โก PowerShell Extension
Extension ID: ms-vscode.PowerShell
Syntax highlighting, debugging, IntelliSense for PowerShell
๐ GitLens
Extension ID: eamodio.gitlens
Enhanced Git capabilities and blame annotations
๐ฆ Quick Install Commands:
# Install extensions via command line
code --install-extension GitHub.vscode-github-extension-pack
code --install-extension ms-vscode.PowerShell
code --install-extension eamodio.gitlens
Configure GitHub Integration
- Open VS Code
- Press Ctrl+Shift+P and type "GitHub: Sign In"
- Authenticate with your GitHub account
- VS Code will automatically sync your repositories
๐ฏ Key VS Code Git Features:
Windows Engineer Workflow
๐ Example: Editing a PowerShell Script
# 1. Open repository in VS Code
code C:\Projects\PowerShell-Tools
# 2. Create new branch (Ctrl+Shift+P โ "Git: Create Branch")
# 3. Edit your PowerShell script with full IntelliSense
# 4. Use integrated terminal for testing:
.\Scripts\Backup-Files.ps1 -WhatIf
# 5. Stage changes in Source Control panel
# 6. Commit with descriptive message
# 7. Push branch and create PR directly in VS Code
๐ Tool Comparison Guide
| Feature | Git CLI | GitHub Desktop | VS Code + GitHub |
|---|---|---|---|
| Learning Curve | โญโญโญโญโญ (Steep) | โญโญ (Easy) | โญโญโญ (Moderate) |
| Power & Flexibility | โญโญโญโญโญ (Maximum) | โญโญโญ (Limited) | โญโญโญโญ (High) |
| Visual Interface | โ Text only | โ Full GUI | โ Integrated GUI |
| PowerShell Integration | โ Native | โ External editor needed | โ Excellent with extension |
| Python Integration | โ Via terminal | โ External editor needed | โ Built-in support |
| Merge Conflicts | โญโญ (Text-based) | โญโญโญโญ (Visual tools) | โญโญโญโญโญ (Best-in-class) |
| Pull Requests | โ Web browser only | โ View and create | โ Full management |
| Automation Friendly | โ Perfect for scripts | โ GUI only | โ Tasks and extensions |
๐ฏ Recommendations by Role:
๐จโ๐ป New to Git
Start with: GitHub Desktop + VS Code
Learn Git concepts visually, then gradually use command line
โก PowerShell Developer
Recommended: VS Code + Git CLI
Best PowerShell support with Git integration
๐ง System Administrator
Recommended: Git CLI + GitHub Desktop
Command line for automation, GUI for complex operations
๐ฅ Team Lead
Recommended: All tools
Be proficient with what your team uses
โ Verify Your Setup
Test your installation and configuration:
Working with Repositories
Before you can use Git commands, you need to understand what repositories are and how to work with them. A repository is like a project folder that tracks all changes to your files.
Creating a New Repository
Cloning Existing Repositories
Cloning creates a local copy of a remote repository:
git clone https://github.com/username/repository-name.git
Try It: Clone Simulation
Managing Your Repository
Check Status
git status
Shows modified files and staging area
View History
git log --oneline
Shows commit history in compact format
Quick Check
What's the difference between cloning and forking a repository?
Basic Git Operations
Now that you understand repositories, let's learn the essential Git commands you'll use every day. These four operations form the foundation of Git workflow.
๐ Status
Check what files have changed
โ Add
Stage files for the next commit
๐พ Commit
Save a snapshot of your changes
โ๏ธ Push
Upload your commits to GitHub
Your First Git Workflow
Let's walk through the basic steps of making and sharing changes:
Check Status
git status
See what files you've changed and what's ready to commit
Stage Your Changes
# Stage a specific file
git add myfile.txt
# Stage all changed files
git add .
Tell Git which changes you want to include in your next commit
Commit Your Changes
git commit -m "Add user login feature"
Create a snapshot with a descriptive message
Push to GitHub
git push
Upload your commits to the remote repository
๐ฎ Interactive Git Staging Simulator
Practice the Git workflow by dragging files between states and running commands. This mirrors exactly what happens when you use Git!
๐ My PowerShell Project
๐ Working Directory
Files you've modified but not staged
๐ฆ Staging Area
Files ready to be committed
Drag files here to stage them
or use:git add filename
๐๏ธ Repository
Committed files in your Git history
๐ป Practice Git Commands
Try these commands:
๐ Learning Progress
Quick Check
What command stages all your changes for commit?
Branching & Merging
Once you're comfortable with basic Git operations, branches unlock the real power of Git. Work on features safely without breaking your main code.
๐ณ Branch
A separate line of development
๐ Merge
Combining changes from different branches
โก Conflict
When Git needs help merging changes
โฌ๏ธ Pull
Download changes from remote repository
Complete Git Workflow Guide
๐ Daily Git Workflow for Windows Engineers
Start Your Day - Sync with Remote
# Check current status
git status
# Switch to main branch
git checkout main
# Get latest changes from team
git pull origin main
# See what's new
git log --oneline -5
Always start by syncing with the remote repository to get the latest changes from your team.
Create or Switch to Feature Branch
# Create new feature branch
git checkout -b feature/improve-backup-logging
# Or switch to existing branch
git checkout feature/existing-feature
# Verify you're on the right branch
git branch
Work on features in separate branches to keep main stable.
Make Your Changes
# Edit your PowerShell scripts
# Add-BackupLogging.ps1
# Check what you've changed
git diff
# See which files are modified
git status
Make focused, logical changes. Don't mix unrelated improvements in one commit.
Stage and Commit Changes
# Stage specific files
git add Scripts/Get-SystemInfo.ps1
git add Tests/Get-SystemInfo.Tests.ps1
# Or stage all changes
git add .
# Review what's staged
git diff --staged
# Commit with descriptive message
git commit -m "Add detailed CPU and memory reporting
- Implement Get-CPUInfo function with core count and speed
- Add Get-MemoryInfo with usage percentage calculation
- Include error handling for remote computer access
- Add progress indicators for multi-computer reporting"
Write commit messages that explain WHY you made the changes, not just WHAT changed.
Push and Share Your Work
# Push branch to remote (first time)
git push -u origin feature/cpu-memory-reporting
# Subsequent pushes
git push
# Create pull request on GitHub
# (Done via web interface)
Push regularly to backup your work and share progress with your team.
๐ Feature Development Workflow
Phase 1: Planning & Setup
# Start from latest main
git checkout main
git pull origin main
# Create descriptive feature branch
git checkout -b feature/azure-blob-backup
# Set up tracking with remote
git push -u origin feature/azure-blob-backup
Phase 2: Development Cycle
# Work in small commits
git add Scripts/Azure-Backup.ps1
git commit -m "Add Azure Blob Storage connection module"
git add Scripts/Azure-Backup.ps1
git commit -m "Implement file upload with progress tracking"
git add Tests/Azure-Backup.Tests.ps1
git commit -m "Add unit tests for Azure backup functions"
# Push frequently
git push
Phase 3: Stay Current
# Regularly sync with main to avoid conflicts
git checkout main
git pull origin main
git checkout feature/azure-blob-backup
git merge main
# Resolve any conflicts and continue
Phase 4: Testing & Cleanup
# Run tests before submitting
Invoke-Pester -Path ./Tests/
# Clean up commit history if needed
git rebase -i HEAD~5 # Interactive rebase
# Final push
git push --force-with-lease # Safe force push
Phase 5: Integration
# Create pull request via GitHub web interface
# After approval and merge, clean up
git checkout main
git pull origin main
git branch -d feature/azure-blob-backup
git push origin --delete feature/azure-blob-backup
๐ฅ Team Collaboration Workflow
Scenario: Team developing a System Information Reporter tool
๐ง Developer A (You)
Working on CPU and Memory reporting
๐จโ๐ป Developer B
Working on disk and network info
๐ฉโ๐ผ Team Lead
Reviews and merges changes
Team standup - assign work
# Everyone syncs with main
git checkout main && git pull origin main
Create feature branches
# You
git checkout -b feature/cpu-memory-reporting
# Developer B
git checkout -b feature/disk-network-info
Share progress - create draft PR
# Push work in progress
git push -u origin feature/cpu-memory-reporting
# Create draft pull request for early feedback
Merge conflict resolution
# Developer B merged their changes to main
# You need to update your branch
git checkout main
git pull origin main
git checkout feature/cpu-memory-reporting
git merge main
# Resolve conflicts in shared helper functions
# Edit conflicted files, then:
git add .
git commit -m "Merge main - resolve utility function conflicts"
Ready for review
# Mark PR as ready for review
# Team lead reviews code
# Address feedback with additional commits
Merge and cleanup
# After approval, team lead merges
# Clean up your local repository
git checkout main
git pull origin main
git branch -d feature/cpu-memory-reporting
๐ Collaboration Best Practices
- Communicate early: Create draft PRs to share progress
- Small commits: Make focused, reviewable changes
- Descriptive branches: Use clear naming like feature/what-it-does
- Regular syncing: Merge main into your branch frequently
- Test before pushing: Run tests locally first
- Review thoroughly: Take time to understand teammates' code
๐ฎ Interactive Workflow Simulator
Click "Start New Feature" to begin the simulation...
๐ณ Branching and Merging
Creating and Switching Branches
Branches let you work on different features without affecting the main code:
# Create a new branch
git branch feature/new-login-system
# Create and switch to new branch in one command
git checkout -b feature/new-login-system
# Switch between branches
git checkout main
git checkout feature/new-login-system
# List all branches
git branch
Merging Branches
When your feature is complete, merge it back to main:
# Switch to main branch first
git checkout main
# Pull latest changes
git pull origin main
# Merge your feature branch
git merge feature/new-login-system
# Delete the feature branch (optional)
git branch -d feature/new-login-system
Resolving Merge Conflicts
When Git can't automatically merge changes, you'll need to resolve conflicts:
# When merge conflict occurs, Git will show:
# CONFLICT (content): Merge conflict in filename.txt
# 1. Open the conflicted file and look for conflict markers:
# <<<<<<< HEAD
# Your current branch changes
# =======
# Changes from the branch being merged
# >>>>>>> feature/new-login-system
# 2. Edit the file to resolve conflicts
# 3. Stage the resolved file
git add filename.txt
# 4. Complete the merge
git commit
Example Conflict Resolution:
โ Before (Conflicted)
function loginUser() {
<<<<<<< HEAD
return authenticateWithDatabase(user);
=======
return authenticateWithAPI(user);
>>>>>>> feature/new-login-system
}
โ After (Resolved)
function loginUser() {
// Use API authentication for better security
return authenticateWithAPI(user);
}
Advanced GitHub Features
๐ด Forking and Contributing
Contribute to open source projects by forking repositories:
Fork a Repository
- Go to the repository on GitHub
- Click the "Fork" button in the top-right
- Choose your account to fork to
- GitHub creates your own copy
Clone Your Fork
# Clone your forked repository
git clone https://github.com/username/project-name.git
cd project-name
# Add the original repository as upstream
git remote add upstream https://github.com/organization/project-name.git
# Verify remotes
git remote -v
Keep Your Fork Synchronized
# Fetch changes from upstream
git fetch upstream
# Switch to main branch
git checkout main
# Merge upstream changes
git merge upstream/main
# Push updates to your fork
git push origin main
๐ Pull Requests
Propose changes and collaborate through pull requests:
Creating a Pull Request
- Push your changes to a branch on GitHub
- Go to the repository on GitHub
- Click "Compare & pull request"
- Write a clear title and description
- Click "Create pull request"
Review and Comment
- Review code: Check the "Files changed" tab
- Add comments: Click line numbers to comment
- Approve/Request changes: Use the review options
- Merge: Once approved, merge the PR
๐ Issues and Project Management
Track bugs, tasks, and feature requests:
Creating Issues
- Go to the "Issues" tab
- Click "New issue"
- Choose a template (bug, feature, etc.)
- Fill in details and assign labels
- Submit the issue
Managing Issues
- Labels: Categorize with bug, enhancement, etc.
- Assignees: Assign to team members
- Milestones: Group issues by release
- Projects: Use kanban boards
๐ท๏ธ Releases and Tags
Version your software with tags and releases:
Creating Tags
# Create an annotated tag
git tag -a v1.0.0 -m "Version 1.0.0 - Initial release"
# Push tag to GitHub
git push origin v1.0.0
# Push all tags
git push --tags
GitHub Releases
- Go to "Releases" tab on GitHub
- Click "Create a new release"
- Choose existing tag or create new one
- Add release notes and files
- Publish the release
๐ Documentation Essentials
Essential files every repository needs:
README.md
# Project Name
Brief description of what your project does.
## Installation
```bash
git clone https://github.com/username/project.git
cd project
npm install
```
## Usage
Explain how to use your project with examples.
## Contributing
Guidelines for contributors.
## License
This project is licensed under the MIT License.
.gitignore
# Dependencies
node_modules/
*.log
# Build outputs
dist/
build/
# Environment files
.env
.env.local
# OS generated files
.DS_Store
Thumbs.db
# IDE files
.vscode/
*.swp
Adding a License
- Go to your repository on GitHub
- Click "Add file" โ "Create new file"
- Name it "LICENSE"
- GitHub will suggest common licenses
- Choose MIT, Apache, or GPL as appropriate
Quick Check
What happens when you merge a feature branch into main?
Collaboration & Teamwork
GitHub provides powerful tools for seamless collaboration. From code review to project management, work together efficiently and ship better software.
Pull Requests
Propose changes, discuss code, and review contributions before merging. Maintain code quality through collaborative review.
Issues
Track bugs, feature requests, and tasks. Organize work with labels, assignees, and milestones for clear project visibility.
Projects
Organize work with kanban boards, roadmaps, and custom views. Track progress across repositories and teams.
Actions
Automate testing, deployment, and workflows. Build CI/CD pipelines that run on every commit and pull request.
Collaborative Development Workflow
Modern development teams follow a structured workflow that ensures code quality, facilitates review, and maintains project stability.
Branch
Create feature branch
Develop
Make changes & commit
Review
Create pull request
Merge
Deploy to production
Development Timeline
A typical collaborative workflow from idea to deployment.
Create Feature Branch
Start with a clean branch for your feature or fix
Develop & Test
Write code, add tests, and ensure everything works locally
$ git commit -m "feat: implement user authentication system"
Push & Create PR
Share your changes and request review from teammates
# Create pull request on GitHub
Review & Merge
Team reviews code, discusses changes, and merges when approved
"Looks good! Authentication implementation is clean and well-tested. Approved for merge."
Quick Check
What's the main purpose of a pull request?
Best Practices Workshop
Learn professional development practices through interactive exercises and real-world examples
๐ Commit Message Workshop
Practice writing professional commit messages using our interactive builder:
Generated Commit Message:
๐ Security Scanner
Test your code for common security issues. Paste code below and we'll scan for problems:
๐ .gitignore Builder
Build a custom .gitignore file for your project type:
Select Project Types:
Custom Additions:
Generated .gitignore:
# Select project types above to generate content
๐ฟ Branch Naming Practice
Practice creating well-named branches for different scenarios:
Scenario:
Loading scenario...
Branch Naming Guide:
feature/description- New featuresbugfix/issue-description- Bug fixeshotfix/critical-issue- Critical fixesdocs/update-readme- Documentationrefactor/cleanup-auth- Code refactoring
โ Smart Pre-Commit Checklist
Complete the checklist to ensure your code is ready for commit:
GitHub 101 Assessment
Demonstrate your GitHub expertise and earn your certification through this comprehensive 20-question assessment
The Challenge
Put your GitHub knowledge to the test with 20 comprehensive questions covering everything from basic Git operations to advanced collaboration workflows.
Success Criteria
Ready to Begin?
Take your time and think through each question carefully. Test your knowledge of Git and GitHub basics!