Repository URL to install this package:
|
Version:
0.0.0-dbbf5e9efabe69 ▾
|
const gitRemoteOriginUrl = require('git-remote-origin-url');
const currentBranch = require('current-git-branch');
const open = require('open');
module.exports = async () => {
let remote;
try {
remote = await gitRemoteOriginUrl();
} catch (err) {
console.log(`Could not read remote origin: ${err}`);
}
const branch = currentBranch();
const projectName = remote.split('git@github.com:')[1].replace(/\.git$/, '');
let url = `https://github.com/${projectName}/pulls?q=head%3A${branch}`;
if (branch === 'master') {
url = `https://github.com/${projectName}`;
}
open(url);
};