A VS Code extension that adds convenient patch export commands to the Git panel, allowing you to quickly create patches from your Git repository.
- Export Last Commit as Patch: Creates a patch file from the last commit using
git format-patch -1 HEAD
- Export Staged Changes as Patch: Creates a patch file from staged changes using
git diff --staged
- Integrated directly into VS Code's Git panel with intuitive buttons
- Automatically opens created patch files for review
- Smart filename generation based on commit messages
- Clone the repository
- Open VS Code
- Go to Extensions (Ctrl+Shift+P)
- Run the command "Developer: Install extension from location"
- Select the cloned repository
- Open VS Code
- Go to Extensions (Ctrl+Shift+X)
- Search for "Git Patch Export"
- Click Install
Once installed, you'll find two new buttons in your Git panel:
- Click the export button in the Git panel header
- Automatically generates a patch file from your last commit
- File is named based on the commit message (e.g.,
fix-bug-in-parser.patch
) - Opens the patch file automatically for review
- Click the diff button in the Git panel header
- Prompts you to enter a filename for the patch
- Creates a patch file containing all staged changes
- Opens the patch file automatically for review
The buttons appear in two locations:
- Git Panel Header: Available at the top of the Source Control panel
- Context Menu: Right-click on staged files for quick access
Command | Description | Git Command |
---|---|---|
git-patch-export.formatPatch |
Export Last Commit as Patch | git format-patch -1 HEAD |
git-patch-export.stagedDiff |
Export Staged Changes as Patch | git diff --staged > name.patch |
- VS Code 1.60.0 or higher
- Git installed and available in PATH
- Active Git repository in workspace
This extension contributes the following settings:
- No additional settings required - works out of the box!
- Patch files are created in the workspace root directory
- Requires Git to be properly configured in the system PATH
Initial release with core functionality:
- Export last commit as patch
- Export staged changes as patch
- Integration with Git panel UI
- Automatic file opening
Found a bug or want to contribute? Please visit our GitHub repository.
This extension is licensed under the MIT License.
Enjoy using Git Patch Export! 🚀