gg fetch

Fetch updates from remote repository without merging.

Usage

bash
gg fetch              # Fetch all branches
gg fetch --dry-run    # Preview what would be fetched

Options

OptionDescription
-n, --dry-runShow what would be fetched
-y, --yesSkip confirmation prompts

Fetch vs. Pull

Understanding the difference between fetch and pull is important:

gg fetch

  • Downloads new data from remote
  • Updates remote tracking branches
  • Does NOT modify working directory
  • Safe to run anytime

gg pull

  • Fetch + merge in one command
  • Updates your current branch
  • Modifies working directory
  • May require conflict resolution
When to Use Fetch
Use gg fetch when you want to see what's new on the remote without affecting your current work. It's a read-only operation that's always safe.

Output

When you fetch, GitGuru shows what was downloaded:

bash
$ gg fetch

šŸ”„ Fetching from origin...
────────────────────────────────────────────────────────────

Remote: origin (https://github.com/user/repo.git)

Updated branches:
  origin/main          abc1234 → def5678  (+3 commits)
  origin/feature/auth  (new branch)
  origin/bugfix/login  (deleted)

New tags:
  v1.2.0
  v1.2.1

Fetched 3 branches, 2 tags, 156 objects.

What to Do After Fetch

After fetching, you can inspect changes before merging:

bash
# See what commits are on remote
gg log origin/main --not HEAD

# Get AI summary of remote changes
gg ask "what's new on origin/main?"

# Compare your branch to remote
gg diff origin/main

# When ready, merge or rebase
gg pull

Examples

Basic Fetch

bash
# Fetch all updates from origin
gg fetch

Preview Fetch

bash
# See what would be fetched
gg fetch --dry-run

Review Before Merge Workflow

bash
# 1. Fetch updates
gg fetch

# 2. Review what changed
gg ask "summarize commits on origin/main since I last pulled"

# 3. Look at specific changes
gg diff HEAD..origin/main

# 4. Merge when ready
gg pull

Check Remote Branches

bash
# After fetching, see all remote branches
gg ask "list all remote branches"

# Check status against remote
gg status

Remote Tracking Branches

Fetch updates remote tracking branches like origin/main:

bash
# After fetch, check your branch against remote
$ gg status

On branch main
Your branch is behind 'origin/main' by 3 commits

Behind commits:
  def5678 feat: add new feature
  ghi9012 fix: bug fix  
  jkl3456 docs: update readme

Pruning Deleted Branches

Fetch can clean up references to deleted remote branches:

bash
# Fetch and prune deleted branches
gg ask "fetch and prune deleted remote branches"

# Or use git directly
git fetch --prune