From 4fdb88107534cf4c48dc77b0e81cf9a285ce7aba Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Mon, 22 Dec 2025 21:24:50 -0600 Subject: [PATCH] Replace Pull / Push with Sync button --- src/components/git-sync/steps/SyncStep.tsx | 58 ++++++---------------- 1 file changed, 15 insertions(+), 43 deletions(-) diff --git a/src/components/git-sync/steps/SyncStep.tsx b/src/components/git-sync/steps/SyncStep.tsx index 72413188..4e8a0264 100644 --- a/src/components/git-sync/steps/SyncStep.tsx +++ b/src/components/git-sync/steps/SyncStep.tsx @@ -28,7 +28,7 @@ export function SyncStep({ projectId }: StepProps) { ? settings.credentials.find(c => originRemote.url.startsWith(c.origin)) : null; - const handlePull = async () => { + const handleSync = async () => { if (!originRemote) return; setIsPushing(true); @@ -37,35 +37,21 @@ export function SyncStep({ projectId }: StepProps) { try { const dir = `${projectsPath}/${projectId}`; + // Pull first to get latest changes await git.pull({ dir, ref: gitStatus?.currentBranch || 'main', singleBranch: true, }); - } catch (err) { - const message = err instanceof Error ? err.message : 'Failed to pull'; - setError(message); - } finally { - setIsPushing(false); - } - }; - - const handlePush = async () => { - if (!originRemote) return; - - setIsPushing(true); - setError(null); - - try { - const dir = `${projectsPath}/${projectId}`; + // Then push local changes await git.push({ dir, remote: 'origin', ref: gitStatus?.currentBranch || 'main', }); } catch (err) { - const message = err instanceof Error ? err.message : 'Failed to push'; + const message = err instanceof Error ? err.message : 'Failed to sync'; setError(message); } finally { setIsPushing(false); @@ -158,31 +144,17 @@ export function SyncStep({ projectId }: StepProps) { )} -
- - -
+ ); }