From: "Stephen Sinclair" <radarsat1@gmail.com>
To: git@vger.kernel.org
Subject: command prompt script for current branch
Date: Wed, 6 Feb 2008 14:52:56 -0500 [thread overview]
Message-ID: <9b3e2dc20802061152q63bc61acuaecf3f33d4df8b19@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1339 bytes --]
Hello,
Attached is a script I quickly wrote up yesterday. Sometimes I've
found I started working only to realize I was on the wrong branch.
(Now that I'm accustomed to working with git, I make many small
branches, so it happens.)
So I made this small script to simply write the name of the currently
checked out branch, as well as information on how many commits it
differs from the remote tracking branch, if any.
It also appends an exclamation mark if I have uncommitted changes. I
stuck it in my PS1 environment variable, so that it would be part of
my command prompt.
I tried to choose git commands that would be relatively quick, since
this will be run for every single command prompt. If I've chosen
suboptimal ways of doing this, please let me know. There's a few too
many 'grep' and 'sed' commands for my liking, so maybe there is a way
to get the same information more directly instead of parsing git
command output. Anyways, if it's of general interest, I'd be happy to
make a patch for /contrib.
For my tiny git repos, this seems to have pretty much no negative
impact on my work flow. When I cd'd to my git.git clone there was
about a 1/2-second delay the first time, but subsequent command
prompts incurred no visible delay. I've no idea how fast it would be
for something as big as the kernel, for example.
Steve
[-- Attachment #2: curgitbranch.sh --]
[-- Type: application/x-sh, Size: 1960 bytes --]
next reply other threads:[~2008-02-06 19:53 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-06 19:52 Stephen Sinclair [this message]
2008-02-06 20:42 ` command prompt script for current branch Junio C Hamano
2008-02-06 22:14 ` [PATCH (repost)] Improve bash prompt to detect merge / rebase in progress Robin Rosenberg
2008-02-06 22:23 ` Robin Rosenberg
2008-02-06 22:31 ` Junio C Hamano
2008-02-07 0:23 ` Robin Rosenberg
2008-02-07 6:34 ` Shawn O. Pearce
2008-02-08 11:26 ` Steffen Prohaska
2008-02-08 12:25 ` Johannes Schindelin
2008-02-08 13:12 ` Steffen Prohaska
2008-02-08 14:06 ` [PATCH/RFC] Make git-completion.bash a first-class citizen Johannes Schindelin
2008-02-06 23:21 ` [PATCH (repost)] Improve bash prompt to detect merge / rebase in progress Jakub Narebski
2008-02-06 23:44 ` Mike Hommey
2008-02-06 21:09 ` command prompt script for current branch Jakub Narebski
2008-02-06 22:13 ` Stephen Sinclair
2008-02-06 22:56 ` Jakub Narebski
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=9b3e2dc20802061152q63bc61acuaecf3f33d4df8b19@mail.gmail.com \
--to=radarsat1@gmail.com \
--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 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).