{"thread":{"id":"2585","subject":"current HEAD in bash prompt","startedAt":"2005-11-17T08:39:49Z","lastAt":"2005-11-18T14:57:48Z","messageCount":2,"participants":["Ben Clifford","Alex Riesen"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"12187","messageId":"9C44605A-4F0F-42FA-A8ED-A4F7EFA24C32@hawaga.org.uk","threadId":"2585","inReplyTo":null,"subject":"current HEAD in bash prompt","fromName":"Ben Clifford","fromEmail":"benc@hawaga.org.uk","sentAt":"2005-11-17T08:39:49Z","receivedAt":"2005-11-17T08:39:49Z","isPatch":false,"sender":{"key":"benc@hawaga.org.uk","avatar":"https://gravatar.com/avatar/c7ce083471287f8e77b69dd147f757799d1efdd740727fd7e3003f33e88be898?d=mp&s=160"},"body":"After getting a bit confused when having too many branches, and for  \npeople who don't mind extra forks and like too much info in their  \nprompt, I've recently started using this:\n\nexport PS1='!\\! [\\j] \\u@\\h:\\w$(output-git-head-or-blank)\\$ '\n\nwhere output-git-head-or-blank is:\n\n#!/bin/bash\n\nPS_GIT=$(git-symbolic-ref HEAD 2>/dev/null) && echo \"[$(basename  \n$PS_GIT)]\" && exit\n\n# else output nothing\n\n\nWhen in a non-git directory, you get a non-git prompt (of course,  \nmodify this to whatever you want)\n\n!502 [0] benc@piva:~$\n\nand when in a git directory you get (a truncated form of) whatever  \ntoday's head points at:\n\n\n!502 [0] benc@piva:~$ cd src/globe\n!503 [0] benc@piva:~/src/globe[master]$\n\n\n-- \nBen • ベン • Бэн • 벤 • 班明\nhttp://www.hawaga.org.uk/ben/\nMy email is high latency but best way to contact me. Alternatively,  \nSMS number(s) at above URL.\n"},{"id":"12224","messageId":"81b0412b0511180657h6c5a66f8y4a41f3fa20a8b238@mail.gmail.com","threadId":"2585","inReplyTo":"9C44605A-4F0F-42FA-A8ED-A4F7EFA24C32@hawaga.org.uk","subject":"Re: current HEAD in bash prompt","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2005-11-18T14:57:48Z","receivedAt":"2005-11-18T14:57:48Z","isPatch":false,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"On 11/17/05, Ben Clifford <benc@hawaga.org.uk> wrote:\n> After getting a bit confused when having too many branches, and for\n> people who don't mind extra forks and like too much info in their\n> prompt, I've recently started using this:\n>\n> export PS1='!\\! [\\j] \\u@\\h:\\w$(output-git-head-or-blank)\\$ '\n>\n\nI did almost the same, but in .c (attached).\n"}]}