From owner-freebsd-git@freebsd.org Fri Dec 4 15:10:34 2015 Return-Path: Delivered-To: freebsd-git@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 05D84A40DD5 for ; Fri, 4 Dec 2015 15:10:34 +0000 (UTC) (envelope-from m@hardcastle.com) Received: from smtprelay.hostedemail.com (smtprelay0221.hostedemail.com [216.40.44.221]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C5C3510EA; Fri, 4 Dec 2015 15:10:33 +0000 (UTC) (envelope-from m@hardcastle.com) Received: from filter.hostedemail.com (unknown [216.40.38.60]) by smtprelay05.hostedemail.com (Postfix) with ESMTP id 17E822691A0; Fri, 4 Dec 2015 15:10:22 +0000 (UTC) X-Session-Marker: 6D4068617264636173746C652E636F6D X-Spam-Summary: 2, -10, 0, , d41d8cd98f00b204, , ::::, RULES_HIT:41:152:355:379:541:564:599:800:960:966:967:973:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1513:1515:1516:1518:1521:1534:1541:1593:1594:1711:1730:1747:1777:1792:2196:2199:2393:2525:2553:2560:2563:2682:2685:2687:2859:2908:2933:2937:2939:2942:2945:2947:2951:2954:3022:3138:3139:3140:3141:3142:3353:3622:3865:3866:3867:3868:3870:3874:3934:3936:3938:3941:3944:3947:3950:3953:3956:3959:4184:4385:4860:5007:6119:6261:7903:7974:9010:9025:9040:9707:10004:10400:10848:11026:11232:11253:11658:11914:12043:12050:12291:12296:12379:12438:12517:12519:12663:12683:13069:13071:13311:13357:14096:14097:21060:21080, 0, RBL:none, CacheIP:none, Bayesian:0.5, 0.5, 0.5, Netcheck:none, DomainCache:0, MSF:not bulk, SPF:fn, MSBL:0, DNSBL:none, Custom_rules:0:0:0, LFtime:4, LUA_SUMMARY:none X-HE-Tag: sleep04_779e4dee3fb5e X-Filterd-Recvd-Size: 2238 Received: from ericbrooks.matthardcastle.com (173-8-177-193-SFBA.hfc.comcastbusiness.net [173.8.177.193]) (Authenticated sender: m@hardcastle.com) by omf02.hostedemail.com (Postfix) with ESMTPA; Fri, 4 Dec 2015 15:10:21 +0000 (UTC) Subject: Re: Put working git branch in shell prompt for bash and zsh? Mime-Version: 1.0 (Mac OS X Mail 9.2 \(3111\)) Content-Type: text/plain; charset=utf-8 From: "M@ Hardcastle" In-Reply-To: Date: Fri, 4 Dec 2015 07:10:19 -0800 Cc: freebsd-git@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <650C2262-2258-46E1-8F9F-46153853989F@hardcastle.com> References: To: Craig Rodrigues X-Mailer: Apple Mail (2.3111) X-BeenThere: freebsd-git@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Discussion of git use in the FreeBSD project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Dec 2015 15:10:34 -0000 Hi Craig, vcs_info does the trick in zsh. Here's a snippet from my zshrc that = shows the checked out branch with your in a git repo: autoload vcs_info setopt prompt_subst zstyle ':vcs_info:*' formats '|%b' zstyle ':vcs_info:*' enable git cvs svn precmd () { vcs_info } vcs_info_wrapper() { vcs_info if [ -n "$vcs_info_msg_0_" ]; then echo "${vcs_info_msg_0_}$del" fi } PS1=3D'%~$(vcs_info_wrapper) %{$fg[red]%}=EF=A3=BF%{$reset_color%} ' =E2=80=93 m@ > On Dec 4, 2015, at 6:20 AM, Craig Rodrigues = wrote: >=20 > Hi, >=20 > I am heavily using git for my projects these days. > Typically I am working on multiple projects, with > multiple checked out trees. I am also switching > between branches a lot. >=20 > Sometimes because I am working with so many > checked out trees, I lose track of what branch > I am working on. >=20 > Can anyone point me to a "stupid shell trick" > which would put the currently active branch in the > shell prompt? I typically use bash and zsh shells, > so having the trick for those shells would be useful. >=20 > Thank! >=20 > -- > Craig > _______________________________________________ > freebsd-git@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-git > To unsubscribe, send any mail to "freebsd-git-unsubscribe@freebsd.org"