diff --git a/e2e/gitSettingsLayout.spec.ts b/e2e/gitSettingsLayout.spec.ts
new file mode 100644
index 000000000..dc39e8b6d
--- /dev/null
+++ b/e2e/gitSettingsLayout.spec.ts
@@ -0,0 +1,65 @@
+import { expect, ipcCalls, stubDesktop, test } from "./fixtures";
+
+test("Git settings keep the executable and Test button together at narrow widths", async ({ workbench: page }) => {
+ await page.setViewportSize({ width: 560, height: 740 });
+ await stubDesktop(page);
+ const gitPath = "C:/Program Files/Git/cmd/git.exe";
+ const longPath = `C:/${"long-directory-name".repeat(20)}/git.exe`;
+ await page.evaluate(
+ ({ gitPath, longPath }) => {
+ window.__ipc.handlers.vcs_detected_git = () => gitPath;
+ window.__ipc.handlers.vcs_git_version = ({ path }) => ({ path: path || longPath, version: "git version 2.49.0" });
+ window.__ipc.handlers.git_credentials = () => [];
+ },
+ { gitPath, longPath },
+ );
+ await page.keyboard.press("Meta+,");
+ const dialog = page.getByRole("dialog", { name: "Settings", exact: true });
+ const search = dialog.getByRole("textbox", { name: "Search settings" });
+ await search.fill("Path to Git executable");
+ await dialog.getByRole("treeitem", { name: "Git", exact: true }).click();
+ await search.clear();
+
+ const path = dialog.getByRole("textbox", { name: /^Path to Git executable:?$/ });
+ const testButton = dialog.getByRole("button", { name: "Test", exact: true });
+ const branches = dialog.getByRole("textbox", { name: /^Protected branches:?$/ });
+ await expect(path).toHaveAttribute("placeholder", `Auto-detected: ${gitPath}`);
+ for (const width of [560, 580, 1120]) {
+ await page.setViewportSize({ width, height: 740 });
+ await path.scrollIntoViewIfNeeded();
+ const [field, button, patterns] = await Promise.all([
+ path.boundingBox(),
+ testButton.boundingBox(),
+ branches.boundingBox(),
+ ]);
+ if (!field || !button || !patterns) throw new Error("Missing Git settings control bounds");
+ expect(field.y).toBeCloseTo(button.y, 0);
+ if (width <= 580) {
+ const label = await dialog.getByText("Path to Git executable", { exact: true }).boundingBox();
+ if (!label) throw new Error("Missing Git executable label bounds");
+ expect(label.y + label.height).toBeLessThan(field.y);
+ expect(field.width).toBeGreaterThan(150);
+ }
+ expect(field.x + field.width).toBeLessThan(button.x);
+ expect(button.x + button.width).toBeCloseTo(patterns.x + patterns.width, 0);
+ }
+
+ await page.setViewportSize({ width: 560, height: 740 });
+ await testButton.click();
+ const result = dialog.getByRole("status").filter({ hasText: "Git version is 2.49.0" });
+ await expect(result).toContainText(longPath);
+ await expect(result).toBeInViewport({ ratio: 1 });
+ await path.fill(gitPath);
+ await expect(result).toHaveCount(0);
+ await testButton.click();
+ await expect(result).toContainText(gitPath);
+ expect(await ipcCalls(page, "vcs_git_version")).toEqual([{ path: "" }, { path: gitPath }]);
+ expect(await ipcCalls(page, "settings_set")).toEqual([]);
+
+ const update = dialog.getByRole("radiogroup", { name: "Update method" });
+ const merge = update.getByRole("radio", { name: "Merge" });
+ const rebase = update.getByRole("radio", { name: "Rebase" });
+ await expect(merge).toBeChecked();
+ await merge.press("ArrowRight");
+ await expect(rebase).toBeChecked();
+});
diff --git a/src/features/settings/pages/GitSettings.module.css b/src/features/settings/pages/GitSettings.module.css
new file mode 100644
index 000000000..3b6b5a583
--- /dev/null
+++ b/src/features/settings/pages/GitSettings.module.css
@@ -0,0 +1,38 @@
+.executableControls {
+ display: flex;
+ align-items: center;
+ gap: var(--space-2);
+ width: 100%;
+ min-width: 0;
+}
+
+.executableControls > input {
+ flex: 1;
+ min-width: 0;
+}
+
+.testResult {
+ display: block;
+ overflow-wrap: anywhere;
+}
+
+.branchPatterns {
+ width: 100%;
+}
+
+.updateMethods {
+ display: flex;
+ flex-wrap: wrap;
+ gap: var(--space-1) var(--space-4);
+}
+
+@container settings-content (max-width: 440px) {
+ .executable > div {
+ grid-template-columns: minmax(0, 1fr);
+ row-gap: var(--space-1);
+ }
+
+ .executable > div > div {
+ grid-column: 1;
+ }
+}
diff --git a/src/features/settings/pages/vcs.tsx b/src/features/settings/pages/vcs.tsx
index 106ff474c..83e3aff78 100644
--- a/src/features/settings/pages/vcs.tsx
+++ b/src/features/settings/pages/vcs.tsx
@@ -10,14 +10,15 @@ import { call, commands, isTauri, onIdeEvent } from "@/platform/ipc";
import { useProject } from "@/platform/project";
import { WORKFLOW_LIMITS, type IssueLinkValid, type VcsSettingsValid } from "@/platform/workflowSettings";
import { showInFileManagerLabel } from "@/platform/fileManager";
-import { Button, Icon, IconButton, Input, rowSelectionMode, Select, selectRow, type SelectOption, T } from "@/ui";
+import { Button, Icon, IconButton, Input, Radio, rowSelectionMode, Select, selectRow, type SelectOption, T } from "@/ui";
import { choosePath } from "@/platform/choosePath";
-import { Row, SettingSelect } from "../components/Form";
+import { Row, SearchLabel, SettingSelect } from "../components/Form";
import { useSetting } from "../components/context";
import type { AgentModelCatalog, AgentProvider } from "@/bindings";
import type { PageSpec } from "./spec";
import { BoundToggle, Grid, Indented, RadioRow, TableEditor, ToggleNumber } from "./workflowControls";
import styles from "./Workflow.module.css";
+import gitStyles from "./GitSettings.module.css";
import { tx } from "@/platform/i18n";
const L = WORKFLOW_LIMITS;
@@ -296,32 +297,35 @@ function GitExecutableRow() {
}
};
return (
-