Skip to content

Commit

Permalink
chore: minor-fix for discardRemoteBranch
Browse files Browse the repository at this point in the history
  • Loading branch information
Ji Sang Seo committed Feb 17, 2024
1 parent b08f4ca commit eed85c8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 3 additions & 1 deletion cli/oh-my-task-git.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ async function test() {

const options = program.opts();

await git.selectBranch("Select Branch ::", true);
// await git.selectBranch("Select Branch ::", true);
const rm = git.getCurrentBranchRemoteName();
await git.discardRemoteBranch(rm);
}

await test().catch((error) => console.error(error));
6 changes: 5 additions & 1 deletion src/git.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,11 @@ export function getPreviousCommitMessage() {
}

export async function discardRemoteBranch(remoteBranch) {
const command = `git push -d origin ${remoteBranch}`;
const seperatorIdx = remoteBranch.indexOf("/");
const remoteAlias = remoteBranch.slice(0, seperatorIdx);
const branch = remoteBranch.slice(seperatorIdx + 1);

const command = `git push -d ${remoteAlias} ${branch}`;
const res = execSync(command);
return;
}
Expand Down

0 comments on commit eed85c8

Please sign in to comment.