https://github.com/shuttersh/git-links
Normalize git URLs to shorthand format and denormalize to repo, branch or PR links.
https://github.com/shuttersh/git-links
bitbucket git github gitlab url-parser
Last synced: 18 days ago
JSON representation
Normalize git URLs to shorthand format and denormalize to repo, branch or PR links.
- Host: GitHub
- URL: https://github.com/shuttersh/git-links
- Owner: shuttersh
- License: mit
- Created: 2018-06-26T05:24:46.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-06-26T05:41:30.000Z (over 7 years ago)
- Last Synced: 2025-01-22T14:04:14.708Z (10 months ago)
- Topics: bitbucket, git, github, gitlab, url-parser
- Language: TypeScript
- Homepage:
- Size: 43 KB
- Stars: 5
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# git-links [](https://travis-ci.org/shuttersh/git-links) [](https://www.npmjs.com/package/git-links)
Parse git remote URLs to shorthand format as used in the package.json `repository` field and resolve shorthand links to full URLs.
Great for normalizing and denormalizing links to repositories, branches and pull requests.
## Installation
```sh
$ npm install git-links
# or using yarn:
$ yarn add git-links
```
## Usage
```js
import { getShortLink, getBranchPageLink, getPullRequestLink, getRepoPageLink } from 'git-links'
getShortLink('git@github.com:piuccio/cowsay.git')
// => 'github:piuccio/cowsay'
getShortLink('https://gitlab.com/gitlab-org/gitlab-ce.git')
// => 'gitlab:gitlab-org/gitlab-ce'
getRepoPageLink('git@github.com:piuccio/cowsay.git')
// => 'https://github.com/piuccio/cowsay'
getRepoPageLink('github:facebook/react')
// => 'https://github.com/facebook/react'
getBranchPageLink('github:facebook/react', '15-stable')
// => 'https://github.com/facebook/react/tree/15-stable'
getPullRequestLink('bitbucket:ftrack/ftrack-connect', '227')
// => 'https://bitbucket.org/ftrack/ftrack-connect/pull-requests/227'
```
## License
MIT