Skip to content
This repository has been archived by the owner on Jun 10, 2022. It is now read-only.

Commit

Permalink
fix: fix delete current branch
Browse files Browse the repository at this point in the history
  • Loading branch information
UziTech committed Nov 23, 2020
1 parent a525418 commit 2593011
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/commands/delete-branch.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,17 @@ export default {
await helper.checkGitLock(root);
const results = [];
if (branch.selected) {
const defaultBranchName = helper.getDefaultBranch(branches);
if (defaultBranchName) {
const defaultBranch = helper.getDefaultBranch(branches);
if (defaultBranch) {
// if branch is current branch then checkout master first
if (branch.name === defaultBranchName) {
if (branch.name === defaultBranch.name) {
branches = await git.branches(root);
const br = branches.find(b => !b.selected && b.local);
if (br) {
results.push(await git.checkoutBranch(root, br.name));
}
} else {
results.push(await git.checkoutBranch(root, defaultBranchName));
results.push(await git.checkoutBranch(root, defaultBranch.name));
}

if (results.length > 0) {
Expand Down

0 comments on commit 2593011

Please sign in to comment.