Skip to main content

Git Tip of the Day -- What Changed?

You walk into Monday morning, grab your coffee, and stare at your repository. Three weeks of vacation bliss, but now you need to figure out what chaos your team unleashed while you were gone. Sound familiar?

There's nothing quite like that Monday morning dread when you realize you have zero clue what happened to your codebase. Maybe it was a sprint that went sideways, or perhaps someone decided to "refactor a few things" while you were out. Either way, you need answers fast.

The Problem: Repository Archaeology

We've all been there. You pull the latest changes and suddenly nothing makes sense. File structures have shifted, new dependencies appeared out of nowhere, and that critical function you wrote? Gone. Replaced with something that "does the same thing but better."

Rather than playing detective through dozens of commits, let's streamline this process. Git gives you several powerful ways to catch up quickly, and once you nail these commands, you'll never fear coming back to a project again.

Method 1: The Classic git whatchanged

Let's start with the underused gem that does exactly what it says on the tin:

git whatchanged --since='2 weeks ago'

This command shows you commits plus the files that changed in each one. It's like getting a detailed report card for your repository.

Make It Human-Friendly

Git's date parsing is surprisingly flexible. Skip the calendar math:

# These all work
git whatchanged --since='yesterday'
git whatchanged --since='3 weeks ago'
git whatchanged --since='last monday'
git whatchanged --since='2024-01-15'

Target Your Investigation

When you need to focus your search:

# What did Sarah break this week?
git whatchanged --since='1 week ago' --author='Sarah'

# Just show me the last 10 changes
git whatchanged -n 10 --since='1 month ago'

# Focus on specific files or directories
git whatchanged --since='2 weeks ago' -- src/components/

Method 2: Modern Alternative with git log

Here's the thing about git whatchanged — it's technically deprecated. Git's maintainers prefer you use git log with the right flags. Functionally, they're nearly identical, but git log gives you more control:

# Equivalent to whatchanged with better formatting
git log --since='2 weeks ago' --stat --oneline

# My personal favorite for team catchups
git log --since='1 week ago' --pretty=format:'%h %an %s' --stat

PowerShell Users: Level Up Your Game

If you're in PowerShell (and you should be), you can make this even better:

# Create a useful alias
function Get-GitChanges {
param(
[string]$Since = '1 week ago',
[string]$Author = $null
)

$cmd = "git log --since='$Since' --stat --oneline"
if ($Author) {
$cmd += " --author='$Author'"
}
Invoke-Expression $cmd
}

# Usage
Get-GitChanges -Since '2 weeks ago'
Get-GitChanges -Since '3 days ago' -Author 'John'

Method 3: Visual Diff for the Big Picture

Sometimes you need to see the forest, not the trees. For a high-level view of what changed:

# Show just the file names that changed
git diff --name-only HEAD~10..HEAD

# Show file changes with added/deleted line counts
git diff --stat HEAD~20..HEAD

# Compare against a specific branch
git diff --stat main..develop

Real-World Scenarios

Scenario 1: Post-Sprint Investigation

Your team just finished a two-week sprint. You want to see what actually got done:

# Get the overview
git log --since='2 weeks ago' --oneline --no-merges

# See the file impact
git log --since='2 weeks ago' --stat --no-merges

# Check for any surprise dependency changes
git log --since='2 weeks ago' --oneline -- package.json yarn.lock

Scenario 2: Debugging a Regression

Something broke and you suspect it happened in the last week:

# Show all changes with file details
git whatchanged --since='1 week ago' -p

# Focus on a specific problematic area
git log --since='1 week ago' --oneline -- src/auth/

# See who touched the critical files
git log --since='1 week ago' --pretty=format:'%h %an %ad %s' -- src/auth/

Scenario 3: Code Review Preparation

Before diving into a PR review, understand the scope:

# Compare feature branch to main
git log --stat main..feature-branch

# See just the commit messages for context
git log --oneline main..feature-branch

# Get the full diff to understand impact
git diff main..feature-branch --stat

VSCode Integration: Make It Visual

If you're a VSCode user (and honestly, why wouldn't you be?), install the GitLens extension. It surfaces this information directly in your editor:

  • Hover over any line to see when it last changed
  • Use Ctrl+Shift+P → "GitLens: Show File History" for visual timelines
  • The timeline view shows changes over time for the current file

But don't abandon the command line — these Git commands are faster once you memorize them.

Automation: Set It and Forget It

Want to stay on top of changes without thinking about it? Automate the process:

# PowerShell script for daily standup prep
function Get-StandupReport {
Write-Host "=== Changes Since Yesterday ===" -ForegroundColor Green
git log --since='yesterday' --pretty=format:'%Cgreen%h%Creset %an %s' --no-merges

Write-Host "`n=== Files Modified ===" -ForegroundColor Yellow
git diff --name-only HEAD~5..HEAD | Sort-Object | Get-Unique
}

When Things Go Wrong: Recovery Commands

Sometimes your investigation reveals that you need to understand a specific change better:

# See exactly what changed in a specific commit
git show <commit-hash>

# Compare two specific points in time
git diff --stat 2024-01-01..2024-01-15

# Find when a specific line was last modified
git blame filename.js

# Search for when a specific change was introduced
git log -S "function name" --oneline

The Modern Git Workflow Integration

These commands aren't just for catching up after vacation. Build them into your daily workflow:

  • Morning standup prep: git log --since='yesterday' --oneline
  • End-of-week review: git log --since='1 week ago' --stat
  • Before code reviews: git log main..feature-branch --oneline
  • Debugging sessions: git log --since='1 day ago' -- problematic-file.js

Key Takeaways

  • Use git whatchanged or git log --stat to understand repository changes over time
  • Leverage Git's flexible date parsing (yesterday, 2 weeks ago, etc.)
  • Filter by author, files, or date ranges to focus your investigation
  • Automate common scenarios with PowerShell functions or shell aliases
  • Integrate these commands into your daily workflow, not just crisis situations

The next time you return from vacation or dive into an unfamiliar codebase, you'll have the tools to get oriented quickly. No more Monday morning repository archaeology — just clean, efficient investigation that gets you back to productive work.