forge icon indicating copy to clipboard operation
forge copied to clipboard

✨ Feature: Git Pull/Push Remote Operations

Open vasconceloscezar opened this issue 1 month ago • 0 comments

Feature Request

Priority: Low (backlog)

Summary

Add Git pull/push operations to enable syncing with remote repositories directly from Forge UI.

Motivation

  • Currently only local Git operations supported
  • Users need CLI to sync with remotes
  • Collaborative workflows require push/pull capability
  • Worktree branches should be shareable for collaboration

Current Limitations

  • ✅ Can commit locally
  • ✅ Can create PRs
  • ✅ Can merge locally
  • ❌ Cannot pull updates from remote
  • ❌ Cannot push branches to remote
  • ❌ Worktree branches not shareable

Proposed Solution

1. Pull (Fetch + Merge)

Trigger: Manual button or auto-check on task open

UI Location:

  • Git actions toolbar
  • Badge showing "X commits behind" (already exists)
  • Notification when remote has updates

Behavior:

  • Fetch remote changes
  • Show merge preview if conflicts exist
  • Auto-merge if fast-forward possible
  • Handle merge conflicts in UI

2. Push to Remote

Trigger: Manual button after commits

UI Location:

  • Git actions toolbar (next to "Create PR")
  • Show "X commits ahead" indicator

Behavior:

  • Push current branch to remote
  • Create remote branch if doesn't exist
  • Handle authentication (SSH keys, tokens)
  • Show push progress

3. Push Worktree (Collaborative Mode)

Use Case: Multiple agents/developers work on same task

Behavior:

  • Push worktree branch to remote
  • Enable branch sharing across team
  • Real-time collaboration on task attempts

Technical Considerations

Backend:

  • Use libgit2/git2-rs for remote operations
  • Handle authentication (SSH, HTTPS, tokens)
  • Implement conflict resolution UI
  • Track push/pull history

Security:

  • Secure credential storage
  • OAuth token management
  • SSH key integration
  • Branch protection rules

Error Handling:

  • Network failures
  • Authentication errors
  • Merge conflicts
  • Force-push scenarios (prevent data loss)

UI Mockup

Git Actions Toolbar:
[Pull ↓] [Push ↑] [Create PR] [Merge]

Status Indicators:
🟢 Up to date
🔵 2 commits ahead → [Push ↑]
🟡 3 commits behind → [Pull ↓]
🔴 Diverged (ahead 2, behind 3) → [Pull & Rebase]

Future Enhancements

  • Auto-pull on task open (optional)
  • Auto-push after commit (optional)
  • Rebase workflows
  • Cherry-pick from remote
  • Branch sync strategies (merge vs rebase)
  • Multi-remote support (origin, upstream)

Related Issues

  • #232 (GitHub update button) - currently returns null for remote tracking
  • Related to branch status tracking

vasconceloscezar avatar Nov 24 '25 18:11 vasconceloscezar