Skip to content

Commit

Permalink
Optimized commit message for git squash
Browse files Browse the repository at this point in the history
  • Loading branch information
kaihaase committed Sep 12, 2022
1 parent b117f0f commit 66f193a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lenne.tech/cli",
"version": "0.0.77",
"version": "0.0.78",
"description": "lenne.Tech CLI: lt",
"keywords": [
"lenne.Tech",
Expand Down
8 changes: 7 additions & 1 deletion src/commands/git/squash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ const NewCommand: GluegunCommand = {
}
mergeBaseSpin.succeed();

// Get squash message (before reset)
const squashMessage = await git.getFirstBranchCommit(await git.currentBranch(), base);

// Soft reset
const resetSpin = spin('Soft reset');
await git.reset(mergeBase, true);
Expand Down Expand Up @@ -100,7 +103,7 @@ const NewCommand: GluegunCommand = {
await ask({
type: 'input',
name: 'message',
initial: await git.getFirstBranchCommit(await git.currentBranch(), base),
initial: squashMessage,
message: 'Message: ',
})
).message;
Expand All @@ -124,6 +127,9 @@ const NewCommand: GluegunCommand = {
// Success
success(`Squashed ${branch} in ${helper.msToMinutesAndSeconds(timer())}m.`);
info('');
if (!toolbox.parameters.options.fromGluegunMenu) {
process.exit();
}

// For tests
return `squashed ${branch}`;
Expand Down

0 comments on commit 66f193a

Please sign in to comment.