From: Jason <lcprog@lakedaemon.net>
To: linux-c-programming@vger.kernel.org
Subject: Re: [OT] git branches and command prompts
Date: Thu, 26 Aug 2010 16:16:29 -0400 [thread overview]
Message-ID: <4C76CB9D.6060702@lakedaemon.net> (raw)
In-Reply-To: <4C76CACB.5000409@lakedaemon.net>
Sorry, TB mangled the formatting. Hopefully quoting helps. :-(
Jason wrote:
> All,
>
> if you're like me, you play with a lot of open source code. A lot of it
> is now in git repositories. I frequently forget which branch I'm on in
> each project, particularly with Android/Cyanogen. Here's a hack I
> figured out that helps me out, place it in ~/.bashrc :
>
> ### begin ####
> PROMPT_COMMAND="echo -n \${PWD};
> if git branch >/dev/null 2>&1; then
> echo -n \"(\$(git branch | grep ^* | cut -d ' ' -f 2-))\"
> fi"
> PS1="\n[\[\033[01;34m\]\u\[\033[00m\]@\h] $ "
> export PROMPT_COMMAND PS1
> ### end ######
>
> Here's the result:
>
> /home/jason
> [jason@phantom] $ cd src/foss/git.git
> /home/jason/src/foss/git.git (master)
> [jason@phantom] $ git checkout git_shell_dir_opt
> Switched to branch 'git_shell_dir_opt'
> /home/jason/src/foss/git.git (git_shell_dir_opt)
> [jason@phantom] $
>
next prev parent reply other threads:[~2010-08-26 20:16 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-26 20:12 [OT] git branches and command prompts Jason
2010-08-26 20:16 ` Jason [this message]
2010-08-27 0:46 ` Michał Nazarewicz
2010-08-27 3:45 ` Jason
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4C76CB9D.6060702@lakedaemon.net \
--to=lcprog@lakedaemon.net \
--cc=linux-c-programming@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).