Update from Git Manager GUI

This commit is contained in:
2026-03-01 10:31:05 +01:00
parent 1669412115
commit 43750e2d8a
2 changed files with 59 additions and 21 deletions

View File

@@ -15,9 +15,15 @@ async function initRepo(folderPath) {
return true;
}
async function commitAndPush(folderPath, branch = 'master', message = 'Update from Git Manager GUI', progressCb = null) {
async function commitAndPush(folderPath, branch = null, message = 'Update from Git Manager GUI', progressCb = null) {
const git = gitFor(folderPath);
// Branch auto-detect: falls nicht angegeben oder 'HEAD', aktuellen Branch ermitteln
if (!branch || branch === 'HEAD') {
const summary = await git.branchLocal();
branch = summary.current || 'main';
}
await git.add('./*');
try {
@@ -44,8 +50,19 @@ async function commitAndPush(folderPath, branch = 'master', message = 'Update fr
async function getBranches(folderPath) {
const git = gitFor(folderPath);
const summary = await git.branchLocal();
return summary.all;
try {
// Alle Branches: lokal + remote (origin/main, origin/master usw.)
const summary = await git.branch(['-a']);
const all = summary.all
.map(b => b.replace(/^remotes\/origin\//, '').trim())
.filter(b => !b.startsWith('HEAD'))
.filter((b, i, arr) => arr.indexOf(b) === i); // deduplizieren
return all;
} catch (e) {
// Fallback: nur lokale Branches
const local = await git.branchLocal();
return local.all;
}
}
async function getCommitLogs(folderPath, count = 50) {