From a023cea71a16eaa93ff8c8e8aae7b79095d694e7 Mon Sep 17 00:00:00 2001 From: Marc Schreiber Date: Sat, 21 Jan 2023 14:19:52 +0100 Subject: [PATCH] Add git cherry-pick completion (#355) --- custom-completions/git/git-completions.nu | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/custom-completions/git/git-completions.nu b/custom-completions/git/git-completions.nu index 8c22775..13f0e77 100644 --- a/custom-completions/git/git-completions.nu +++ b/custom-completions/git/git-completions.nu @@ -10,6 +10,10 @@ def "nu-complete git log" [] { ^git log --pretty=%h | lines | each { |line| $line | str trim } } +def "nu-complete git commits" [] { + ^git rev-list --all --remotes --pretty=oneline | lines | parse "{value} {description}" +} + # Check out git branches and files export extern "git checkout" [ ...targets: string@"nu-complete git branches" # name of the branch or files to checkout @@ -135,3 +139,16 @@ export extern "git switch" [ --recurse-submodules # update the contents of sub-modules --track(-t) # set "upstream" configuration ] + +# Apply the change introduced by an existing commit +extern "git cherry-pick" [ + commit?: string@"nu-complete git commits" # The commit ID to be cherry-picked + --edit(-e) # Edit the commit message prior to committing + --no-commit(-n) # Apply changes without making any commit + --signoff(-s) # Add Signed-off-by line to the commit message + --ff # Fast-forward if possible + --continue # Continue the operation in progress + --abort # Cancel the operation + --skip # Skip the current commit and continue with the rest of the sequence +] +