#20935·desktop

Add ability to create .patch files

Author: MtMathCreated Aug 25, 2025Updated Sep 17, 2026
Labelsfeature-request

The feature request

Feature Request:

Summary

Add functionality to GitHub Desktop to create patch files (.patch) from commits, allowing users to export and share changes in a portable format.

Problem Statement

Currently, GitHub Desktop lacks the ability to create patch files directly from the interface. Users who need to:

  • Share changes with collaborators who don't have access to the repository
  • Apply changes to different repositories or branches
  • Create backups of specific changes
  • Work with external tools that consume patch files
  • Submit changes to projects that prefer patch-based workflows

Must resort to command line tools (git format-patch, git diff) or other external applications, which disrupts the streamlined workflow that GitHub Desktop provides.

Proposed solution

Proposed Solution

Add patch file creation functionality with the following features:

Core Functionality

  • Single Commit to Patch: Right-click context menu on commits with "Create Patch File" option
  • Multiple Commits to Patch: Select multiple commits and create a single patch file or multiple files
  • Range-based Patches: Create patches for commit ranges (e.g., feature branches)
  • Unstaged Changes to Patch: Create patches from current working directory changes

User Interface Options

  1. Context Menu Integration

    • Right-click on commit(s) → "Export as Patch"
    • Right-click on branch → "Export branch as patches"
  2. Menu Bar Option

    • Repository → Export → Create Patch Files
  3. File Dialog

    • Allow users to choose save location and filename
    • Default naming: 0001-commit-title.patch (following git format-patch convention)

Advanced Features

  • Patch Options:

    • Include/exclude merge commits
    • Add cover letter for patch series
    • Configure patch format (unified diff, context lines)
    • Include binary files option
  • Export Formats:

    • Standard Git patch format
    • Unified diff format
    • Option to create individual files or combined patch

Use Cases

1. Code Review and Collaboration

Scenario: Developer needs to share changes with a colleague who doesn't have repository access. Solution: Export commits as patch files and send via email or messaging.

2. Cross-Repository Changes

Scenario: Apply the same fix across multiple similar projects. Solution: Create patch from one repository and apply to others.

3. Backup and Archival

Scenario: Keep offline backups of important changes before major refactoring. Solution: Export critical commits as patch files for safe keeping.

4. Integration with External Tools

Scenario: Use patches with code review tools, IDEs, or deployment systems that consume patch files. Solution: Direct export from GitHub Desktop eliminates manual command-line steps.

Technical Implementation Suggestions

Backend Integration

  • Leverage existing libgit2 or Git CLI integration
  • Use git format-patch command equivalents
  • Ensure compatibility with standard patch formats

UI Components

  • Modal dialog for patch options
  • Progress indicator for large patch operations
  • Success notification with option to open file location

File Handling

  • Respect user's default download/export directory
  • Handle filename conflicts gracefully
  • Support batch operations for multiple commits

Benefits

  • Workflow Continuity: Keep users within GitHub Desktop ecosystem
  • Accessibility: Make patch creation available to non-command-line users
  • Productivity: Reduce context switching between tools
  • Standardization: Ensure consistent patch format across team

Additional context

Additional Context

This feature would complement GitHub Desktop's mission of making Git accessible to all developers, regardless of command-line proficiency. Many competing Git GUI applications (GitKraken, Sourcetree, etc.) already offer patch export functionality.