0.0.6 • Published 4 years ago

remote-commit-url v0.0.6

Weekly downloads
6
License
MIT
Repository
github
Last release
4 years ago

remote-commit-url

Generate a URL for viewing a commit in the browser.

Usage

CLI

Installation

$ npm i -g remote-commit-url

Usage

$ remote-commit-url [options]
Example
$ remote-commit-url --commit HEAD~1
# https://github.com/nodejs/node/commit/HEAD~1
Options
--commit      Git commit ref [default: HEAD]
--remote      Git remote [default: origin]
--cwd         Path to git repository [default: .]
--git-dir     Path to git directory [default: $GIT_DIR or .git]
--debug       Print debug info

API

Installation

$ npm i remote-commit-url

Usage

const remoteCommitUrl = require('remote-commit-url');

const commit = 'HEAD~1';
const remote = 'origin';
const cwd = '~/Projects/node';

(async () => {
  const url = await remoteCommitUrl({commit, remote, cwd});
  console.log(url); // "https://github.com/nodejs/node/commit/HEAD~1"
})();

Requirements

Node >= 8

Supported platforms

  • Azure DevOps
  • BitBucket
  • GitHub
  • GitLab
  • RhodeCode

License

MIT