mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-08-07 06:08:39 +02:00
refactor(git): move gbcopy to Functions section, update git-dir check and sync README
This commit is contained in:
parent
c04b6c826b
commit
b01ea71086
1 changed files with 11 additions and 11 deletions
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue