mirror of
https://github.com/jimeh/dotfiles.git
synced 2026-02-19 13:46:41 +00:00
added all shell configuration files
This commit is contained in:
22
shell/bash/helpers.sh
Normal file
22
shell/bash/helpers.sh
Normal file
@@ -0,0 +1,22 @@
|
||||
#
|
||||
# Bash Helpers
|
||||
#
|
||||
|
||||
function find_git_branch {
|
||||
local dir=. head
|
||||
until [ "$dir" -ef / ]; do
|
||||
if [ -f "$dir/.git/HEAD" ]; then
|
||||
head=$(< "$dir/.git/HEAD")
|
||||
if [[ $head == ref:\ refs/heads/* ]]; then
|
||||
git_branch=" (${head#*/*/})"
|
||||
elif [[ $head != '' ]]; then
|
||||
git_branch=' (detached)'
|
||||
else
|
||||
git_branch=' (unknown)'
|
||||
fi
|
||||
return
|
||||
fi
|
||||
dir="../$dir"
|
||||
done
|
||||
git_branch=''
|
||||
}
|
||||
Reference in New Issue
Block a user