remote-commit-url

0.0.6 • Public • Published

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

Package Sidebar

Install

npm i remote-commit-url

Weekly Downloads

2

Version

0.0.6

License

MIT

Unpacked Size

5.44 kB

Total Files

7

Last publish

Collaborators

  • madeleinedaly