From 20d560a91000bc460c6d18902f906b4044724a96 Mon Sep 17 00:00:00 2001 From: rgaunt Date: Sat, 6 Dec 2025 13:44:48 +1100 Subject: [PATCH 1/2] Added push to remote functionality. Added push to remote test. --- index.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 99542ea..855b5f6 100755 --- a/index.js +++ b/index.js @@ -303,9 +303,18 @@ export async function main() { // Check if branch is pushed to remote let needsToPush = false; if (!isBranchPushedToRemote(currentBranch)) { - console.log(`\nšŸ”„ Branch '${currentBranch}' not found on remote. Pushing now...`); - needsToPush = true; + const shouldPush = await confirm({ + message: `Branch '${currentBranch}' not found on remote. Push to origin?`, + default: true + }); + if (!shouldPush) { + console.log('\nāŒ Cannot create PR without pushing branch to remote.'); + return; + } + + needsToPush = true; + console.log(`\nšŸ”„ Pushing branch '${currentBranch}' to remote...`); const pushSucceeded = pushBranchToRemote(currentBranch); if (!pushSucceeded) { console.error('\nāŒ Failed to push branch to remote. Cannot create PR.'); From f34fbb99be305c876a197f97e0ee8b6ceba6b25e Mon Sep 17 00:00:00 2001 From: rgaunt Date: Sat, 6 Dec 2025 13:47:21 +1100 Subject: [PATCH 2/2] Improved the remote check. --- index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 855b5f6..3a394be 100755 --- a/index.js +++ b/index.js @@ -96,8 +96,9 @@ export function getRemoteBranches() { export function isBranchPushedToRemote(branchName) { try { // Check if the branch exists on the remote - execSync(`git ls-remote --heads origin ${branchName}`, { stdio: 'ignore' }); - return true; + const output = execSync(`git ls-remote --heads origin ${branchName}`).toString().trim(); + // If output is empty, branch doesn't exist on remote + return output.length > 0; } catch { return false; }