1

In magit, if I call git-link in a buffer that is visiting a file being version controlled, I get a github link.

Is there a way to get the canonical form of that link directly from emacs, without having to go to github and press y to get the canonical form for that link?

3
  • The help for git-link states The URL will be added to the kill ring, so after calling git-link you should be able to paste the URL anywhere within Emacs. If you don't want git-link to automatically open the browser, you can set git-link-open-in-browser to nil.
    – Arnot
    Aug 28, 2017 at 8:31
  • git-link uses the branch name instead of the commit-hash to generate a link, e.g. github.com/MyUser/myProject/blob/myBranch/README.md. I actually wondering if something like git-link-canonical already exists, ideally this function would return github.com/MyUser/myProject/blob/…
    – Cesc
    Aug 28, 2017 at 21:52
  • git-link can generate links that use the commit hash if git-link-use-commit is set to non-nil. By running (setf git-link-use-commit t), git-link will generate the links using the commit hash instead of the branch name.
    – Arnot
    Aug 29, 2017 at 8:46

1 Answer 1

2

git-link can generate links that use the commit hash if git-link-use-commit is set to non-nil. By running (setf git-link-use-commit t), git-link will generate the links using the commit hash instead of the branch name.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.