Monday, May 17, 2010

GIT Branch in Zsh (or Bash)

It's been a long damn day and a half, but here's the final code for my .zshrc:

For Bash, here's my PS1 (albeit, the important part is \$(parse_git_branch) , but I don't want to go shopping for a Bash prompt for now): Big thanks to the people who answered my questions here and here. Now I'm finally ready for zsh!

Note: So much has been learned from this one, though. Even GIT has a plumbing vs. porcelain (logic/presentation) split. The new command, thanks to Chris Johnsen, teaches us all that what felt wrong all this time--parsing git status---really was. Using the plumbing commands gives us long-term stability. This is particularly important if you don't ever want to do shell scripting again :)

To be fair (to myself), parsing GIT status is just one call, whereas the new script is three. But until we have speed problems, we don't worry about it. Better yet, Chris' script runs on Bash and Zshell without modification!
Oh yeah, the only other change I made was to sub
ls -G
ls --color
from the zsh scripts I got from Zsh: The Last Shell You'll Ever Need.

No comments: