Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

feat(git): add Push button to push all branches with unpushed commits

Adam Eivy69bdc002261b
diff --git a/client/src/components/apps/tabs/GitTab.jsx b/client/src/components/apps/tabs/GitTab.jsx
index ae54e3a9c0..1d920ff2d4 100644
--- a/client/src/components/apps/tabs/GitTab.jsx
+++ b/client/src/components/apps/tabs/GitTab.jsx
@@ -91,6 +91,7 @@ export default function GitTab({ appId, appName, repoPath }) {
const [checkingOut, setCheckingOut] = useState(null);
const [pushing, setPushing] = useState(null);
const [syncing, setSyncing] = useState(null);
+ const [pushingAll, setPushingAll] = useState(false);
const loadGitInfo = useCallback(async () => {
if (!repoPath) return;
@@ -217,6 +218,22 @@ export default function GitTab({ appId, appName, repoPath }) {
}
};
+ const handlePushAll = async () => {
+ if (!repoPath || pushingAll) return;
+ setPushingAll(true);
+ const result = await api.pushAllBranches(repoPath).catch(() => null);
+ setPushingAll(false);
+ if (result?.success) {
+ toast.success(`Pushed ${result.pushed} branch${result.pushed === 1 ? '' : 'es'}`);
+ } else if (result) {
+ const failedNames = Object.entries(result.results || {})
+ .filter(([, v]) => !v.success)
+ .map(([name]) => name);
+ toast.error(`Push failed for: ${failedNames.join(', ')}`);
+ }
+ await loadGitInfo();
+ };
+
const getStatusIcon = (file) => {
if (file.added) return <Plus size={14} className="text-port-success" />;
if (file.deleted) return <Minus size={14} className="text-port-error" />;
@@ -235,14 +252,26 @@ export default function GitTab({ appId, appName, repoPath }) {
<div className="space-y-6">
<div className="flex items-center justify-between">
<h2 className="text-lg font-semibold text-white">Git Status</h2>
- <button
- onClick={handleUpdateBranches}
- disabled={updating}
- className="flex items-center gap-1.5 px-3 py-2 bg-port-card border border-port-border rounded-lg text-sm text-gray-300 hover:text-white hover:border-port-accent disabled:opacity-50"
- >
- <Download size={16} className={updating ? 'animate-bounce' : ''} />
- {updating ? 'Updating...' : 'Update'}
- </button>
+ <div className="flex items-center gap-2">
+ {branches.some(b => b.tracking && b.ahead > 0) && (
+ <button
+ onClick={handlePushAll}
+ disabled={pushingAll}
+ className="flex items-center gap-1.5 px-3 py-2 bg-port-card border border-port-border rounded-lg text-sm text-gray-300 hover:text-white hover:border-port-success disabled:opacity-50"
+ >
+ <Upload size={16} className={pushingAll ? 'animate-bounce' : ''} />
+ {pushingAll ? 'Pushing...' : 'Push'}
+ </button>
+ )}
+ <button
+ onClick={handleUpdateBranches}
+ disabled={updating}
+ className="flex items-center gap-1.5 px-3 py-2 bg-port-card border border-port-border rounded-lg text-sm text-gray-300 hover:text-white hover:border-port-accent disabled:opacity-50"
+ >
+ <Download size={16} className={updating ? 'animate-bounce' : ''} />
+ {updating ? 'Updating...' : 'Update'}
+ </button>
+ </div>
</div>
{loading ? (
diff --git a/client/src/services/api.js b/client/src/services/api.js
index 9fff14d35f..a3446d2345 100644
--- a/client/src/services/api.js
+++ b/client/src/services/api.js
@@ -329,6 +329,10 @@ export const pushBranch = (path, branch) => request('/git/push', {
method: 'POST',
body: JSON.stringify({ path, branch })
});
+export const pushAllBranches = (path) => request('/git/push-all', {
+ method: 'POST',
+ body: JSON.stringify({ path })
+});
export const getBranches = (path) => request('/git/branches', {
method: 'POST',
body: JSON.stringify({ path })
diff --git a/server/routes/git.js b/server/routes/git.js
index c45c2fccbb..e3b0148a40 100644
--- a/server/routes/git.js
+++ b/server/routes/git.js
@@ -127,6 +127,18 @@ router.post('/push', asyncHandler(async (req, res) => {
res.json(result);
}));
+// POST /api/git/push-all - Push all branches with unpushed commits
+router.post('/push-all', asyncHandler(async (req, res) => {
+ const { path } = req.body;
+
+ if (!path) {
+ throw new ServerError('path is required', { status: 400, code: 'VALIDATION_ERROR' });
+ }
+
+ const result = await git.pushAll(path);
+ res.json(result);
+}));
+
// POST /api/git/info - Get full git info for a path
router.post('/info', asyncHandler(async (req, res) => {
const { path } = req.body;
diff --git a/server/services/git.js b/server/services/git.js
index e0bd9e8fe7..66350f3173 100644
--- a/server/services/git.js
+++ b/server/services/git.js
@@ -312,6 +312,38 @@ export async function push(dir, branch = null) {
return { success: true, output: result.stdout + result.stderr };
}
+/**
+ * Push all local branches that are ahead of their remote tracking branch.
+ * Never uses --force. Returns per-branch results.
+ */
+export async function pushAll(dir) {
+ const allBranches = await getBranches(dir);
+ const pushable = allBranches.filter(b => b.tracking && b.ahead > 0);
+
+ if (pushable.length === 0) {
+ return { success: true, pushed: 0, results: {}, message: 'Nothing to push' };
+ }
+
+ const results = {};
+ let failed = 0;
+
+ for (const branch of pushable) {
+ const r = await execGit(['push', 'origin', branch.name], dir, { ignoreExitCode: true });
+ const output = (r.stdout || '') + (r.stderr || '');
+ const ok = !output.includes('rejected') && !output.includes('fatal') && !output.includes('error:');
+ results[branch.name] = { success: ok, output: output.trim() };
+ if (!ok) failed++;
+ }
+
+ return {
+ success: failed === 0,
+ pushed: pushable.length - failed,
+ failed,
+ total: pushable.length,
+ results
+ };
+}
+
/**
* Create and switch to a new branch
*/