From: Miguel Bazdresch <monotone-01@thewizardstower.org>
To: git@vger.kernel.org
Subject: Re: [PATCH] Add git-branches-script
Date: Wed, 17 Aug 2005 15:37:58 -0500 [thread overview]
Message-ID: <20050817203758.GA1332@localhost.domain.invalid> (raw)
In-Reply-To: <20050815204430.GA77829@rossby.metr.ou.edu>
* Amos Waterland <apw@rossby.metr.ou.edu> [2005-08-16 00:48]:
> For people whose workflow involves switching back and forth between a
> lot of branches, it can be really helpful to be able to quickly tell
> which branch you are on and which ones are available. This patch
> introduces a small script that when invoked as `git branches' prints a
> list of available branches with a star in front of the one you are on:
>
> $ cd linux-2.6/
> $ git checkout -b ppc64-cleanups
> $ git checkout -b ppc64-new-devel
> $ git checkout -b ppc64-all-merge
> $ git branches
> master
> * ppc64-all-merge
> ppc64-cleanups
> ppc64-new-devel
Some might find it useful to put Amos' script in a bash function and
then put the current branch in the prompt. What I did was to put this
function in my .bashrc:
gitbranch () {
. git-sh-setup-script &&
branch=$(basename $(readlink $GIT_DIR/HEAD)) &&
echo -n "" $branch ""
}
Then I modified my bash prompt:
export PS1='\[\033[1;31m\]\j$(gitbranch)[\w]\$ \[\033[0m\]'
^^^^^^^^^^^
Now, if my current dir is not a git repo, I have my regular prompt. As
soon as I cd into a git repo, I get the current branch in the prompt, as
follows:
0[~]$ cd gitrepo
0 master [~/gitrepo]$ git checkout branch1
0 branch1 [~/gitrepo]$ cd ..
0[~]$
--
Miguel Bazdresch
http://thewizardstower.org/
prev parent reply other threads:[~2005-08-17 20:31 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-08-15 20:44 [PATCH] Add git-branches-script Amos Waterland
2005-08-16 17:53 ` Kalle Valo
2005-08-16 17:58 ` [PATCH] Change git-branch to list branches Kalle Valo
2005-08-16 21:08 ` Junio C Hamano
2005-08-17 19:48 ` Kalle Valo
2005-08-17 20:15 ` Kalle Valo
2005-08-17 20:37 ` Miguel Bazdresch [this message]
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=20050817203758.GA1332@localhost.domain.invalid \
--to=monotone-01@thewizardstower.org \
--cc=git@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.