Live data from Hacker News

A heads up display for git

github.com

21–30 of 62 posts

Re: A heads up display for git

#22
post #9

I use a modified version of mislav's git prompt https://gist.github.com/mislav/1712320 which is pretty minimal but usually enough for me. For when I have to wrangle lots of files at once (like during interactive rebase to clean up history before push) I have a git watch alias that shows a high-level overview of changes that refreshes with inotify: [alias] watch = "!clear;inotifywait --quiet -mr -e modify,move,create,…

I'm going to steal this, thanks. I'll probably make it a script file instead of an alias, though.

Post the Gist when you're done, please?

Re: A heads up display for git

#23
You could negate the need for a --bash or --zsh flag by checking $SHELL:

  echo $SHELL | egrep -o '[a-z]+$'
It might also make sense to bundle everything under one file as well. While I'd normally advocate separating code into smaller and more manageable files, a single file shell script would be more convenient to install and would require less disk reads per every prompt call.

Looks good though. I'm definitely going to use this on my dev boxes.

Re: A heads up display for git

#24
For anyone interested in putting together their own version, I customized my bash terminal (including git related info) using the following resources:

- Mikko Nylén's comment in http://web.archive.org/web/20130127054804/http://asemanfar.c...

- http://stackoverflow.com/questions/8120553/bash-profile-sett...

- http://volnitsky.com/project/git-prompt/

- http://misc.flogisoft.com/bash/tip_colors_and_formatting

- http://tldp.org/LDP/abs/html/string-manipulation.html

- http://www.botsko.net/blog/2010/03/16/git-status-in-command-...

Re: A heads up display for git

#25
post #23

You could negate the need for a --bash or --zsh flag by checking $SHELL: echo $SHELL | egrep -o '[a-z]+$' It might also make sense to bundle everything under one file as well. While I'd normally advocate separating code into smaller and more manageable files, a single file shell script would be more convenient to install and would require less disk reads per every prompt call. Looks good though. I'm definitely going…

I did try that on a previous tool Butler (https://github.com/michaeldfallen/butler) but I found that some shells don't actually set `$SHELL`.

Re: A heads up display for git

#27
This is neat and I think there's a lot of potential here. As with many information displays, though, it's critical to consider what the most important information to convey is and how to effectively do it.

My main question is around the use of color. I'd argue the error states - conflicts, diverging branches, etc - should be the ones in red, since those are the issues you want to call the most attention to.

Getting rid of any chartjunk is the other big thing. Using four characters of every prompt just for `git:` is not reasonable. And as much as I like the idea of being warned about untracked files, I fear that in most real situations you end up with random scratch files in the same directory. My prompt would always say `7A` at the end, wasting more space (and mental effort!).

Good work!

Re: A heads up display for git

#28
post #10

Earlier quoted context omitted.

Is that configurable? That is to say, can I change what's printed to the prompt to add more info like # of files added/removed/modified? I looked into it a little bit it looked hard-coded.

yeah it's pretty configurable, the syntax to do so is rather ugly though. I'm using it like this: https://gist.github.com/lorenzhs/c8b442ce831f0211f3d8 which shows me whether I have staged and unstaged changes, the current branch and commit, rebase/... status, etc. I don't remember from where I got this config, it's a mix of things I found online.

Interesting, thanks!

Re: A heads up display for git

#29

This is neat and I think there's a lot of potential here. As with many information displays, though, it's critical to consider what the most important information to convey is and how to effectively do it. My main question is around the use of color. I'd argue the error states - conflicts, diverging branches, etc - should be the ones in red, since those are the issues you want to call the most attention to. Getting r…

Thanks! Glad you like it.

Fair point on the `git:(`, it's mostly a hold over from robbyrussells oh-my-zsh theme (which inspired me to make the first version of this about 2 years ago (https://github.com/michaeldfallen/oh-my-zsh/blob/master/them...).

The entire thing is composable so if you want a prompt without those bits just fork and modify: https://github.com/michaeldfallen/git-radar/blob/master/prom....

Or should I be making these "pieces" like `git:(` and `)` configurable through args / env vars?

On the untracked files I personally never leave a file untracked. I either commit it or add it to .gitignore. Though I see how you use git differently, how about a --ignore-untracked to ignore untracked files?

Post reply on HN