From 3aca4170920cda1f8096de50987f470cbbcf121a Mon Sep 17 00:00:00 2001 From: Yang Cao Date: Tue, 28 Dec 2021 13:58:23 +0800 Subject: [PATCH] Updated Custom Commands Compendium (markdown) --- Custom-Commands-Compendium.md | 58 +++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/Custom-Commands-Compendium.md b/Custom-Commands-Compendium.md index c802b5b..e56e99f 100644 --- a/Custom-Commands-Compendium.md +++ b/Custom-Commands-Compendium.md @@ -121,6 +121,64 @@ customCommands: valueFormat: '{{ .commit_id }}' labelFormat: '{{ .commit_id | green | bold }} - {{ .commit_msg | yellow }}' ``` + +## Fetch a remote branch as a new local branch + +```yml +customCommands: + - key: '' + description: 'fetch a remote branch as a new local branch' + command: "git fetch {{index .SelectedRemote.Name }} {{index .PromptResponses 0}}:{{index .PromptResponses 1}}" + context: 'remotes' + prompts: + - type: 'input' + title: 'Remote Branch Name' + initialValue: '' + - type: 'input' + title: 'New Local Branch Name' + initialValue: '' + loadingText: 'fetching branch' +``` + +## Commit as non-default author + +```yml +customCommands: + - key: '' + description: 'commit as non-default author' + command: 'git commit -m "{{index .PromptResponses 0}}" --author="{{index .PromptResponses 1}} <{{index .PromptResponses 2}}>"' + context: 'files' + prompts: + - type: 'input' + title: 'Commit Message' + initialValue: '' + - type: 'input' + title: 'Author Name' + initialValue: '' + - type: 'input' + title: 'Email Address' + initialValue: '' + loadingText: 'commiting' +``` + +## Amend the author of last commit + +```yml +customCommands: + - key: '' + description: 'amend the author of last commit' + command: 'git commit --amend --author="{{index .PromptResponses 0}} <{{index .PromptResponses 1}}>"' + context: 'commits' + prompts: + - type: 'input' + title: 'Author Name' + initialValue: '' + - type: 'input' + title: 'Email Address' + initialValue: '' + subprocess: true +``` + Example Usage on lazygit repo: - Search word: `lazygit` - Subtree/File: `**/commits.go`