blob: f4d41f01c404406c6f9a1ad29749e4b80f683d44 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# Prints the current git branch, if any
function __fish_git_branch_prompt
set gitdir (git rev-parse --git-dir 2>/dev/null)
if [ -z $gitdir ]
return 0
end
set branch (git symbolic-ref HEAD 2>/dev/null| cut -d / -f 3)
# check for rebase, bisect, etc
# TODO
# no branch, print hash of HEAD
if [ -z $branch ]
set branch (git log HEAD\^..HEAD --pretty=format:%h 2>/dev/null)
end
if [ ! -z $branch ]
echo " ($branch) "
end
end
|