Introduction ¶ What is Git? ¶ What is GitHub? ¶ Learning Objectives ¶ Setting Up GitHub Account ¶ Creating Your GitHub Account ¶ Installing Git ¶ Installation Instructions ¶ Verifying Installation ¶ # Check Git version
git --version
# Check installation location
which git # macOS/Linux
where git # WindowsConfiguring Git ¶ Essential Configuration ¶ # Replace with your actual name and GitHub email
git config --global user.name "Your Full Name"
git config --global user.email "your.github@email.com"Verification ¶ # View all global configuration
git config --global --list
# Check specific values
git config --global user.name
git config --global user.emailUnderstanding Git Concepts ¶ Core Git Concepts ¶ The Git Workflow ¶ Essential Git Commands ¶ Starting a New Project ¶ # Navigate to your project folder
cd ~/my-geo-project
# Initialize Git repository
git init
# Check repository status
git status# Clone a repository from GitHub
git clone https://github.com/<your-username>/intro-gispro.gitTracking Changes ¶ # Add specific files
git add analysis.py# Add all files in current directory
git add .# See status of all files
git status
# See detailed changes
git diff# Commit with inline message
git commit -m "Add rainfall analysis function"
# Commit all tracked files (skip staging)
git commit -am "Update visualization parameters"Writing Good Commit Messages ¶ git commit -m "Add NDVI calculation for Landsat 8 imagery"
git commit -m "Fix coordinate transformation bug in UTM conversion"
git commit -m "Update flood mapping algorithm to handle edge cases"Working with GitHub ¶ # Add remote repository
git remote add origin https://github.com/<your-username>/<repo-name>.git# Push to GitHub (first time)
git push -u origin main
# Push subsequent changes
git push# Pull changes from GitHub
git pullBasic Branching ¶ # Create new branch for experimental feature
git checkout -b satellite-analysis
# List all branches
git branch
# Switch back to main branch
git checkout main
# Merge feature branch into main
git merge satellite-analysis
# Delete merged branch
git branch -d satellite-analysisViewing Project History ¶ # View commit history
git log
# Compact one-line format
git log --oneline
# View specific file history
git log -- data_processing.pyUndoing Changes ¶ # Undo last commit but keep changes
git reset --soft HEAD~1Using GitHub ¶ Creating Repositories on GitHub ¶ Basic Collaboration ¶ Repository Management ¶ Integration with VS Code ¶ Best Practices for Geospatial Projects ¶ Repository Structure ¶ What to Track vs. Ignore ¶ Commit Message Conventions ¶ # Format: <type>: <description>
git commit -m "feat: add NDVI calculation for Sentinel-2"
git commit -m "fix: handle NoData values in elevation processing"
git commit -m "docs: update README with installation instructions"Key Takeaways ¶ Exercises ¶ Exercise 1: Setting Up Git and GitHub ¶ Exercise 2: Your First Repository ¶ Exercise 3: Collaboration and Pull Requests ¶