Update Q4 2018: Yes, it is possible possible with Git 2.20: an alias that expands to another alias has so far been forbidden, but now it is allowed to create such an alias.
See commit fef5f7f, commit 82f71d9, commit c6d75bc (16 Sep 2018) by Tim Schumacher (timschumi
).
(Merged by Junio C Hamano -- gitster
-- in commit 506ee60, 16 Oct 2018)
alias
: add support for aliases of an alias
Aliases can only contain non-alias git commands and their arguments, not other user-defined aliases. Resolving further (nested) aliases is prevented by breaking the loop after the first alias was processed.
Git then fails with a command-not-found error.
Allow resolving nested aliases by not breaking the loop in run_argv()
after the first alias was processed.
Instead, continue the loop until handle_alias()
fails, which means that there are no
further aliases that can be processed. Prevent looping aliases by storing substituted commands in cmd_list
and checking if a command has been substituted previously.
So... this will be possible now:
git config alias.nested-internal-1 nested-internal-2
git config alias.nested-internal-2 status
git nested-internal-1
That would be a git status
.
With Git 2.30 (Q1 2021), the command line completion script (in contrib/) learned to expand commands that are alias of alias.
See commit e4c75ed (12 Nov 2020), and commit c2822a8, commit 9414938 (09 Nov 2020) by Felipe Contreras (felipec
).
(Merged by Junio C Hamano -- gitster
-- in commit fd6445a, 25 Nov 2020)
completion
: bash: support recursive aliases
Signed-off-by: Felipe Contreras
It is possible to have recursive aliases like:
l = log --oneline
lg = l --graph
So the completion should detect such aliases as well.