From c04b6c826ba7648b587eb7e87734490d00c56601 Mon Sep 17 00:00:00 2001 From: NunzioFornitto Date: Wed, 29 Jul 2026 17:35:42 +0200 Subject: [PATCH] feat(git): use git symbolic-ref in gbcopy and align README docs --- plugins/git/README.md | 4 ++-- plugins/git/git.plugin.zsh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/git/README.md b/plugins/git/README.md index 6f25a4428..d6c5b28b5 100644 --- a/plugins/git/README.md +++ b/plugins/git/README.md @@ -253,8 +253,8 @@ receive further support. | `git_current_user_email` | Returns the `user.email` config value (Lives in `lib/git.zsh`) | | `git_current_user_name` | Returns the `user.name` config value (Lives in `lib/git.zsh`) | | `git_develop_branch` | Returns the name of the “development” branch: `dev`, `devel`, `development` if they exist, `develop` otherwise | -| `git_main_branch` | Returns the name of the main branch: `main` if it exists, `master` otherwise | -| `gbcopy` | Copy current branch name to clipboard | +| `git_main_branch` | Returns the name of the main branch: `main` if it exists, `master` otherwise | +| `gbcopy` | Copies current branch name to clipboard | | `grename ` | Renames branch `` to ``, including on the origin remote | | `gbda` | Deletes all merged branches | | `gbds` | Deletes all squash-merged branches (**Note: performance degrades with number of branches**) | diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 3e1e1c5e1..ce2cc373d 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -135,7 +135,7 @@ function gbcopy() { command git rev-parse --is-inside-work-tree &>/dev/null || return local branch - branch="$(git_current_branch)" || return + branch="$(command git symbolic-ref --short -q HEAD)" || return [[ -n "$branch" ]] || return 1 print -rn -- "$branch" | clipcopy