From 726cedd375160dbea7aa065fe52cccd20a8efc53 Mon Sep 17 00:00:00 2001 From: NunzioFornitto Date: Wed, 1 Jul 2026 18:20:16 +0200 Subject: [PATCH 1/2] feat(git): add gcb helper to copy current branch name Signed-off-by: NunzioFornitto --- plugins/git/git.plugin.zsh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 9ef60d69a..f8bf09c47 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -68,6 +68,13 @@ function grename() { # (sorted alphabetically by function name) # (order should follow README) # +function gcb() { + # Controlla se siamo in un repository Git + command git rev-parse --is-inside-work-tree &>/dev/null || return + + # Prende il branch corrente, rimuove il newline e lo copia negli appunti + command git branch --show-current | tr -d '\n' | clipcopy +} # Similar to `gunwip` but recursive "Unwips" all recent `--wip--` commits not just the last one function gunwipall() { From 0002238f40497ca69717af9ea0cbf26ffb763fd4 Mon Sep 17 00:00:00 2001 From: Nunzio Fornitto <76222591+NunzioFornitto@users.noreply.github.com> Date: Wed, 1 Jul 2026 18:35:51 +0200 Subject: [PATCH 2/2] refactor(git): rename helper to gcbn and optimize code based on review Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- plugins/git/git.plugin.zsh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index f8bf09c47..ff7f41d88 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -68,12 +68,15 @@ function grename() { # (sorted alphabetically by function name) # (order should follow README) # -function gcb() { - # Controlla se siamo in un repository Git +function gcbn() { + # Check if we are in a Git repository command git rev-parse --is-inside-work-tree &>/dev/null || return - # Prende il branch corrente, rimuove il newline e lo copia negli appunti - command git branch --show-current | tr -d '\n' | clipcopy + local branch + branch="$(git_current_branch)" || return + [[ -n "$branch" ]] || return 1 + + print -rn -- "$branch" | clipcopy } # Similar to `gunwip` but recursive "Unwips" all recent `--wip--` commits not just the last one