Installing core or library from a branch or commit

Is there a way to install a core or library from a particular branch or commit number with the arduino-cli command line?

Perhaps something like $ arduino-cli core install arduino:megaavr@branch:master

For the benefit of others interested in this subject, I’ll share a link to @woolsey’s feature request in the Arduino CLI issue tracker, where we had some nice discussion: