diff options
author | Hugues Hiegel <hugues@hiegel.fr> | 2008-03-03 17:53:55 +0100 |
---|---|---|
committer | Hugues Hiegel <hugues@hiegel.fr> | 2008-03-07 14:15:21 +0100 |
commit | f176f894daa2ef723248b32807a234c26b718a24 (patch) | |
tree | 4bbda2b69eabc28f89984b3ac058547c4b34b98e | |
parent | 0909b9e00e1b559a25a706d9adc824f25a76a7df (diff) |
Show abbreviated commit-id instead of "(no branch)" in prompt.
-rw-r--r-- | 01_Functions.zsh | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/01_Functions.zsh b/01_Functions.zsh index a4aa38a..f6b300a 100644 --- a/01_Functions.zsh +++ b/01_Functions.zsh @@ -39,7 +39,10 @@ preprint() get_git_branch () { - echo $(git branch 2>&- | grep -E '^\* ' | cut -c3-) + my_git_branch="$(git branch 2>&- | grep -E '^\* ' | cut -c3-)" + [ $my_git_branch == "(no branch)" ] && my_git_branch="$(git-log HEAD~1..HEAD --pretty=format:%h)" + + echo $my_git_branch } check_git_status () |