-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Description
Is your feature request related to a problem? Please describe.
When working with the custom patch builder, lazygit currently allows copying the generated patch to the clipboard, but there is no built-in way to save the patch directly to a file.
This can be inconvenient when the patch needs to be reviewed later, shared with others, applied manually using git apply, or stored as a temporary artifact during a larger workflow.
At the moment, users have to copy the patch to the clipboard and manually paste it into a file, which is error-prone and interrupts the workflow.
Describe the solution you'd like
Add an option in the custom patch options menu to save the generated patch directly to a file.
Proposed behavior:
- Add a “Save patch to file” option alongside the existing clipboard option
- Prompt the user for a file path
- Support both absolute and relative paths (with relative paths resolved from the repository root)
- Write the generated patch content to the specified file
- Show a confirmation toast after the file is successfully written
This would provide a smoother workflow for users who frequently need to export patches.
Describe alternatives you've considered
- Copying the patch to the clipboard and manually pasting it into a file
- Using external scripts or custom commands to capture the patch output
These approaches work but are less discoverable and less convenient than a built-in option.
Additional context
I have a working implementation that adds a new menu item to the custom patch options menu, prompts for a file path, saves the rendered aggregated patch to disk, and includes the necessary i18n strings.
If this feature is acceptable, I’m happy to open a PR with the implementation.