Live data from Hacker News

A heads up display for git

github.com

11–20 of 62 posts

Re: A heads up display for git

#12
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.

Re: A heads up display for git

#13
post #6

I use something similar for my bash prompt: https://github.com/xtrementl/dev-bash-git-ps1 I wonder if this one is any faster. Waiting for a bash prompt in large repos can be frustrating.

I added logic to mine to check for a .noprompt file and disable the git part of my bash prompt as I generally want it enabled, but a few large repos are too slow with it. You could do something similar, I'm sure.

Re: A heads up display for git

#16
post #10

Earlier quoted context omitted.

I find the ZSH git extension to work very well.

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.

Re: A heads up display for git

#17
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,…

How would this need to be changed to work on osx?

Re: A heads up display for git

#18
post #17
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,…

How would this need to be changed to work on osx?

Just need to replace inotifywait with an FSEvents-based change watcher.

Re: A heads up display for git

#19
post #6

I use something similar for my bash prompt: https://github.com/xtrementl/dev-bash-git-ps1 I wonder if this one is any faster. Waiting for a bash prompt in large repos can be frustrating.

I added logic to mine to check for a .noprompt file and disable the git part of my bash prompt as I generally want it enabled, but a few large repos are too slow with it. You could do something similar, I'm sure.

I wonder if an asynchronous approach could be implemented. Like starting the git status and the likes in a separate process and killing it after a certain timeout if it takes too long.

While I like that there is a .noprompt feature it's mainly a workaround. Maybe there could be a toggle feature where the user can turn on and off the git prompt on demand, wouldn't be hard to implement.

Maybe I will start hacking on it, I have some ideas to optimize it further.

Post reply on HN