Skip to content

Commit c79e5b3

Browse files
committed
Add tag detection
1 parent b032b41 commit c79e5b3

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

prompt.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,13 @@ find_git_branch() {
22
# Based on: http://stackoverflow.com/a/13003854/170413
33
local branch
44
if branch=$(git rev-parse --abbrev-ref HEAD 2> /dev/null); then
5+
# check to see if on a tag
56
if [[ "$branch" == "HEAD" ]]; then
6-
branch='detached*'
7+
if tag=$(git describe --exact-match >&1 2> /dev/null); then
8+
branch="tags/$tag"
9+
else
10+
branch='detached*'
11+
fi
712
fi
813
git_branch="($branch)"
914
else

0 commit comments

Comments
 (0)