mirror of
https://git.decapod.one/brethil/dotfiles
synced 2024-11-21 11:01:31 +01:00
zsh: cleanup git functions
This commit is contained in:
parent
4d9462239f
commit
58201b2ab7
|
@ -34,7 +34,6 @@ function git-sort-branch-by-usage(){
|
||||||
function git-switch-recent-branch(){
|
function git-switch-recent-branch(){
|
||||||
git switch $1
|
git switch $1
|
||||||
}
|
}
|
||||||
# compdef git-sort-branch-by-usage git-switch-recent-branch
|
|
||||||
compdef "__git_completion_wrapper __git_recent_branches" git-switch-recent-branch
|
compdef "__git_completion_wrapper __git_recent_branches" git-switch-recent-branch
|
||||||
|
|
||||||
function git-commit-show() {
|
function git-commit-show() {
|
||||||
|
@ -81,18 +80,26 @@ function gco() {
|
||||||
if [[ "$#" -ge 1 ]]; then
|
if [[ "$#" -ge 1 ]]; then
|
||||||
g checkout $@
|
g checkout $@
|
||||||
elif [[ "$#" -eq 0 ]]; then
|
elif [[ "$#" -eq 0 ]]; then
|
||||||
g checkout $(gb | fzf)
|
local selected
|
||||||
|
selected=$(git branch --format "%(refname)" | cut -d / -f 3- | fzf)
|
||||||
|
if [[ -n $selected ]]; then
|
||||||
|
git checkout "$selected"
|
||||||
|
else
|
||||||
|
echo "Nothing selected"
|
||||||
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
}
|
}
|
||||||
|
compdef "__git_completion_wrapper _git-checkout" gco
|
||||||
|
|
||||||
|
|
||||||
_disable_alias gcor
|
_disable_alias gcor
|
||||||
function gcor() {
|
function gcor() {
|
||||||
if [[ "$#" -ge 1 ]]; then
|
if [[ "$#" -ge 1 ]]; then
|
||||||
g checkout $@
|
git checkout $@
|
||||||
elif [[ "$#" -eq 0 ]]; then
|
elif [[ "$#" -eq 0 ]]; then
|
||||||
g checkout --track $(gbr | fzf)
|
git checkout --track $(gbr | fzf)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -110,9 +117,9 @@ compdef "__git_completion_wrapper __git_recent_branches" gbd
|
||||||
_disable_alias gbD
|
_disable_alias gbD
|
||||||
function gbD() {
|
function gbD() {
|
||||||
if [[ "$#" -ge 1 ]]; then
|
if [[ "$#" -ge 1 ]]; then
|
||||||
g branch -D $@
|
git branch -D $@
|
||||||
elif [[ "$#" -eq 0 ]]; then
|
elif [[ "$#" -eq 0 ]]; then
|
||||||
g branch -D $(gb | fzf -m)
|
git branch -D $(git branch | fzf -m)
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
compdef "__git_completion_wrapper __git_recent_branches" gbD
|
compdef "__git_completion_wrapper __git_recent_branches" gbD
|
||||||
|
|
Loading…
Reference in New Issue
Block a user