feat: add one-click git sync button

Combine fetch, pull with rebase, and push into one sync action
Keep remote dropdown focused on safe fetch actions
Block sync when uncommitted changes would conflict with rebase
This commit is contained in:
Bohdan Triapitsyn
2026-05-05 20:45:31 +03:00
parent ddfd2db0b8
commit c80c2b62a8
17 changed files with 217 additions and 209 deletions
+6 -2
View File
@@ -2360,11 +2360,11 @@ export async function gitPush(
*/
export async function gitPull(
directory: string,
options?: { remote?: string; branch?: string }
options?: { remote?: string; branch?: string; rebase?: boolean }
): Promise<{ success: boolean; summary: { changes: number; insertions: number; deletions: number }; files: string[]; insertions: number; deletions: number }> {
const repo = await getRepository(directory);
if (repo) {
if (repo && options?.rebase !== true) {
try {
await repo.pull();
return {
@@ -2381,10 +2381,14 @@ export async function gitPull(
// Fallback to raw git
const args = ['pull'];
if (options?.rebase === true) args.push('--rebase');
if (options?.remote) args.push(options.remote);
if (options?.branch) args.push(options.branch);
const result = await execGit(args, directory);
if (result.exitCode !== 0) {
throw new Error(result.stderr.trim() || result.stdout.trim() || 'Failed to pull from remote');
}
return {
success: result.exitCode === 0,