From b01ea7108650d0f7d1e8feb3989a62839d8601cc Mon Sep 17 00:00:00 2001 From: NunzioFornitto Date: Wed, 29 Jul 2026 17:48:31 +0200 Subject: [PATCH] refactor(git): move gbcopy to Functions section, update git-dir check and sync README --- plugins/git/git.plugin.zsh | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index ce2cc373d..e01e66713 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -49,6 +49,17 @@ function git_main_branch() { return 1 } +function gbcopy() { + # Check if we are in a Git repository + command git rev-parse --is-inside-work-tree &>/dev/null || return + + local branch + branch="$(command git symbolic-ref --short -q HEAD)" || return + [[ -n "$branch" ]] || return 1 + + print -rn -- "$branch" | clipcopy +} + function grename() { if [[ -z "$1" || -z "$2" ]]; then echo "Usage: $0 old_branch new_branch" @@ -130,17 +141,6 @@ alias gba='git branch --all' alias gbd='git branch --delete' alias gbD='git branch --delete --force' -function gbcopy() { - # Check if we are in a Git repository - command git rev-parse --is-inside-work-tree &>/dev/null || return - - local branch - branch="$(command git symbolic-ref --short -q HEAD)" || return - [[ -n "$branch" ]] || return 1 - - print -rn -- "$branch" | clipcopy -} - function gbda() { git branch --no-color --merged | command grep -vE "^([+*]|\s*($(git_main_branch)|$(git_develop_branch))\s*$)" | command xargs git branch --delete 2>/dev/null }