When using a VCS, (I use Mercurial and Git in Linux, Bash prompt), is there any way to have the prompt show the current head or tag in the directory?
More than once I have shot myself in the foot by working in one head when thinking I was in another, for example, pushing v0.3 to testing when they needed v.02, or patching bugs in dev then they needed to be patched in prod, or vice versa.
Git provides a bash function that shows the current branch or hash if headless. Look for __git_ps1 in the bash_completion file.
My
~/.bashrccontains these lines:which will create a prompt like this: