refactor(git): move gbcopy to Functions section, update git-dir check and sync README

This commit is contained in:
NunzioFornitto 2026-07-29 17:48:31 +02:00
commit b01ea71086

View file

@ -49,6 +49,17 @@ function git_main_branch() {
return 1 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() { function grename() {
if [[ -z "$1" || -z "$2" ]]; then if [[ -z "$1" || -z "$2" ]]; then
echo "Usage: $0 old_branch new_branch" 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'
alias gbD='git branch --delete --force' 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() { 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 git branch --no-color --merged | command grep -vE "^([+*]|\s*($(git_main_branch)|$(git_develop_branch))\s*$)" | command xargs git branch --delete 2>/dev/null
} }