If I run a regular git command such as git checkout
I get helpful autocompletion of branch names when hitting the tab key.
I have a few git aliases which ta
Update July 2015 (Git 2.5): getting the git aliases is easier in contrib/completion/git-completion.bash
.
See commit 12bdc88, commit e8f9e42 (10 May 2015) by SZEDER Gábor (szeder).
(Merged by Junio C Hamano -- gitster -- in commit 935d937, 22 May 2015)
~~~~~~~~~~~~~~
Git completion should work better with complex aliases in Git 2.1 (August 2014).
See commit 56f24e8 by Steffen Prohaska (sprohaska)
!f() { ... }; f
' and "!sh -c '...' -
" aliases'
!f() { ... }; f
' and "!sh -c '....' -
" are recommended patterns for declaring more complex aliases (see git wiki).
This commit teaches the completion to handle them.When determining which completion to use for an alias, an opening brace or single quote is now skipped, and the search for a git command is continued.
For example, the aliases '!f() { git commit ... }
' or "!sh -c 'git commit ...'
" now trigger commit completion.
Previously, the search stopped on the opening brace or quote, and the completion tried it to determine how to complete, which obviously was useless.The
null
command ':
' is now skipped, so that it can be used as a workaround to declare the desired completion style.For example, the aliases:
!f() { : git commit ; if ... } f
!sh -c ': git commit; if ...' -
now trigger commit completion.
Shell function declarations now work with or without space before the parens, i.e. '
!f() ...
' and '!f () ...
' both work.