jesseduffield / jesseduffield/lazygit

Apply patch from clipboard

Open
#3,396 8 comments 17 reactions 0 assignees View on GitHub
enhancement
Dominant language
Go
Stars
82.4k
Forks
3k
Avg merge
2d 18h
Merged PRs (30d)
19

Description

**Is your feature request related to a problem? Please describe.**
We already have a couple ways of copying a patch to the clipboard:
* 'Copy patch to clipboard' option in custom patch options menu
* 'Diff of all files' / 'Diff of selected file' in files view 'Copy to clipboard' menu

But we don't have any keybindings for actually doing something with that patch once it's copied.

I had a use-case for this recently where I wanted to copy a patch from one repo to another (we were migrating to a monorepo). I had to apply the patch manually via `pbpaste | git apply` (works on mac).

**Describe the solution you'd like**
I'm thinking this keybinding should live in the 'Patch options' menu, as an option labeled 'Apply patch from clipboard' (and 'Apply patch from clipboard in reverse'). Currently if custom patch mode is not active, we show an error rather than display the menu, so now we would instead just have that error appear as a disabled reason against each menu item that actually requires a custom patch.

To increase discoverability, we should add a tooltip to the file view's copy-diff-to-clipboard options mentioned above explaining how to go about applying the patch (i.e. press ctrl+p to bring up patch options menu and then select 'Apply patch from clipboard'). I also think we should add the file view's copy-diff-to-clipboard options to the patch options menu so that in order to satisfy the use case you only need to use one menu.

What do people think?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.