gg pull

Pull changes from remote repository with merge or rebase options.

Usage

bash
gg pull              # Standard pull with merge
gg pull --rebase     # Pull with rebase
gg pull --dry-run    # Preview incoming changes

Options

OptionDescription
-r, --rebaseRebase local commits on top of upstream
--dry-runShow what would be pulled
-y, --yesSkip confirmation prompts

Merge vs. Rebase

Pull with Merge (Default)

Creates a merge commit when there are divergent histories:

bash
gg pull

# Result: Merge commit created
# History: Preserves all branch history

Pull with Rebase

Replays your local commits on top of the remote branch for linear history:

bash
gg pull --rebase

# Result: Local commits replayed on top
# History: Linear, cleaner log
When to Use Rebase
Use --rebase when working on feature branches to maintain a clean, linear history. Avoid rebasing shared branches that others are working on.

Preview Mode

See what changes will be pulled without actually pulling:

bash
$ gg pull --dry-run

šŸ“„ Pull Preview
────────────────────────────────────────────────────────────

Fetching from origin...

Incoming commits:
  abc1234 fix: resolve null pointer exception
  def5678 feat: add user preferences
  ghi9012 docs: update API documentation

Files to be updated:
  M  src/services/user.ts
  M  src/components/Settings.tsx
  A  docs/api.md

Total: 3 commits, 3 files changed

Handling Conflicts

When conflicts occur during pull, GitGuru provides AI assistance:

bash
$ gg pull

āš ļø  Conflict detected in src/config.ts

Use GitGuru AI to help resolve:
  gg ask "resolve conflicts in src/config.ts"
  gg explain   # See what conflicted and why

Resolving Conflicts

bash
# Get AI help with conflicts
gg ask "help me resolve merge conflicts"

# After resolving, continue
gg commit -m "Merge remote changes"
# or
gg ask "commit merge resolution"

Examples

Basic Pull

bash
# Pull latest changes from remote
gg pull

# Pull with automatic yes
gg pull -y

Rebase Workflow

bash
# Keep feature branch up to date with clean history
git checkout feature/my-feature
gg pull --rebase

# If conflicts occur, resolve and continue
gg ask "continue rebase after resolving conflicts"

Before Pushing

bash
# Always pull before pushing to avoid conflicts
gg pull
gg push

# Or use sync to do both
gg sync

Working with Uncommitted Changes

If you have uncommitted changes, GitGuru will warn you:

bash
$ gg pull

āš ļø  You have uncommitted changes

Options:
  1. Stash changes: gg ask "stash my changes"
  2. Commit changes: gg commit
  3. Cancel pull

What would you like to do?
bash
# Stash, pull, then restore
gg ask "stash my changes"
gg pull
gg ask "apply stash"

Tracking Branches

Pull from a specific remote branch:

bash
# Pull from specific branch
gg ask "pull from origin/main into current branch"

# Set up tracking and pull
gg ask "set upstream to origin/main and pull"