From b0ea5fe09a9b46cf3d11450776e11e92eaadca6f Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Tue, 31 May 2022 22:36:37 +1000 Subject: [PATCH] Updated Custom Commands Compendium (markdown) --- Custom-Commands-Compendium.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Custom-Commands-Compendium.md b/Custom-Commands-Compendium.md index dc7067c..bad780f 100644 --- a/Custom-Commands-Compendium.md +++ b/Custom-Commands-Compendium.md @@ -249,4 +249,16 @@ customCommands: context: files description: tig file (history of commits affecting file) subprocess: yes +``` + +## Extract diff into index + +This requires some explanation: say you've got a PR that has merged in master a few times and so it's a bit of a mess to follow the changes, but there's actually not that many lines changed in total. In that case, you probably just want to take the actual changes and put them in a single commit on top of the head of the master branch. + +```yml +customCommands: + - key: 'D' + command: git diff {{.SelectedLocalBranch.Name}} > /tmp/lazygit.patch && git reset --hard {{.SelectedLocalBranch.Name}} && git apply /tmp/lazygit.patch + context: localBranches + description: Extract diff into index ``` \ No newline at end of file