git completions installed
This commit is contained in:
parent
6678a31ae7
commit
8855304904
7 changed files with 474 additions and 1 deletions
3
.config/fish/functions/git_current_branch.fish
Normal file
3
.config/fish/functions/git_current_branch.fish
Normal file
|
@ -0,0 +1,3 @@
|
|||
function git_current_branch -d 'Detect name of current branch of current git repository'
|
||||
echo (git branch --show-current)
|
||||
end
|
10
.config/fish/functions/git_develop_branch.fish
Normal file
10
.config/fish/functions/git_develop_branch.fish
Normal file
|
@ -0,0 +1,10 @@
|
|||
function git_develop_branch -d 'Detect name of develop branch of current git repository'
|
||||
command git rev-parse --git-dir &>/dev/null || return
|
||||
for branch in dev devel development
|
||||
if command git show-ref -q --verify refs/heads/$branch
|
||||
echo $branch
|
||||
return
|
||||
end
|
||||
end
|
||||
echo develop
|
||||
end
|
9
.config/fish/functions/git_feature_branch_prepend.fish
Normal file
9
.config/fish/functions/git_feature_branch_prepend.fish
Normal file
|
@ -0,0 +1,9 @@
|
|||
function git_feature_branch_prepend -d 'Detect prepend of feature branches of git repository'
|
||||
command git rev-parse --git-dir &>/dev/null || return
|
||||
if string match -q '*/feat/*' (git show-ref)
|
||||
echo feat
|
||||
return
|
||||
end
|
||||
echo feature
|
||||
end
|
||||
|
11
.config/fish/functions/git_main_branch.fish
Normal file
11
.config/fish/functions/git_main_branch.fish
Normal file
|
@ -0,0 +1,11 @@
|
|||
function git_main_branch -d 'Detect name of main branch of current git repository'
|
||||
# heuristic to return the name of the main branch
|
||||
command git rev-parse --git-dir &> /dev/null || return
|
||||
for ref in refs/{heads,remotes/{origin,upstream}}/{main,master,trunk}
|
||||
if command git show-ref -q --verify $ref
|
||||
echo (string split -r -m1 -f2 / $ref)
|
||||
return
|
||||
end
|
||||
end
|
||||
echo main
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue