'Get Github latest commit url - zsh shell

How to get Github latest commit url using cli in zsh?
example output: https://github.com/my_user/my_repo/commit/0904dcc315ec80d024440dda5208ebf1d7edbcb3

This is related to the question I asked sometime back for Windows powershell but now I've switched to Mac and looking for a similar command for zsh shell. The command mentioned in the answer is of course not compatible with zsh.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source