Get the GitLab or GitHub URL for a specific commit using the command line from the local checkout of the repository

I thought my problems were solved when i saw that the git-open utility, which i was already using, had an issue to add a –commit option with a merged-in merge request referenced.

Removed my npm-installed version and just git cloned it into a grabbag SoftwareApplications folder i have and

cd ~/SoftwareApplications/
git clone git@github.com:paulirish/git-open.git
sudo ln -s ~/SoftwareApplications/git-open/git-open /usr/local/bin/git-open

Now i can do this:

git-open -c

But it can only open the current commit. But at least i can quickly get the URL structure for commits for my repo, and then paste in the commit hash i want replacing the current one to get a link to share.