I have to admit, I love git. It has really made me more efficient, and I can’t honestly think of ever switching back to ie. svn.
My shell is bash, and up until now I used a very simple bash completion for git, but at times I do see myself wanting something a bit more comprehensive. However, I really don’t want bash to be slow to open (of course, the definition of “slow” is quite individual – over a second is way too much ;), which it can be if it needs to load all bash completion definitions when starting. Therefore I wrote a small bash function for my .bashrc that will dynamically load the git bash completion when it first is accessed. Bash starts fast, and I get git bash completion – problem solved (well, the first time git bash completion is used, it of course takes a tad longer than normal because it needs to load it first, but that’s completely livable). As a bonus, it will fall back to my old and simple completion if the proper one is not available.
Tags: bash, bash completion, git
| This entry was posted on Monday, October 12th, 2009 at 22:27 and is filed under git, Random. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site. |
[...] Planet !Mandriva: http://blog.zerodogg.org/2009/10/12/dynamically-loading-git-bash-completion/ !gnu [...]
Just a by the way ZSH does that builtins (autoload on demand) and have a fairly complete git completion….. but well a shell can be a hard thing to change….
Really? That’s quite neat – I must admit I have very rarely used a shell other than bash.
Though, like you said, a shell can be a hard thing to change, I’m not sure if I could make myself do it, plus:
[0 zerodogg@firefly ~]$ wc -l .bashrc
506 .bashrc