git-mikado/src/commands/new_branch.ts

28 lines
629 B
TypeScript

import Git from 'simple-git';
import inquirer from 'inquirer';
async function check_workspace_clean() {
return Git().status().then((result) => {
if (!result.isClean()) throw new Error('workspace not clean, aborting');
})
}
export default async () => {
await check_workspace_clean();
const result = await Git().branch({'--merged': 'HEAD'});
const ancestors = result.all;
const resp = await inquirer.prompt([
{
name: 'parent',
message: 'grand-parent branch: ',
type: 'list',
choices: ancestors,
}
])
console.log(resp);
}