-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathrebase.js
More file actions
64 lines (53 loc) · 1.65 KB
/
rebase.js
File metadata and controls
64 lines (53 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/env node
import { execSync } from 'node:child_process';
const tasks = [
{ branch: 'ENT-chat-starter', base: 'FULL' },
{ branch: 'ENT-llm-integration-starter', base: 'FULL' },
{ branch: 'ENT-nf-sol', base: 'FULL' },
{ branch: 'ENT-nf-starter', base: 'FULL' },
{ branch: 'ENT-sheriff-starter', base: 'FULL' },
{ branch: 'ENT-signal-forms-starter', base: 'FULL' },
{ branch: 'ENT-signal-store-starter', base: 'FULL' },
{ branch: 'ENT-signals-solution', base: 'FULL' },
{ branch: 'ENT-signals-starter', base: 'ENT-signals-solution' },
];
function run(cmd) {
console.log(`\n> ${cmd}`);
execSync(cmd, { stdio: 'inherit' });
}
function main() {
// Sicherheitscheck: sauberes Working Tree
try {
const status = execSync('git status --porcelain', {
encoding: 'utf8',
}).trim();
if (status.length > 0) {
console.error(
'❌ Working tree ist nicht clean. Bitte commit/stash vorher.',
);
process.exit(1);
}
} catch {
console.error('❌ Kein Git-Repo oder git nicht verfügbar.');
process.exit(1);
}
const startBranch = execSync('git branch --show-current', {
encoding: 'utf8',
}).trim();
for (const { branch, base } of tasks) {
console.log(`\n==============================`);
console.log(`Rebase: ${branch} <- ${base}`);
console.log(`==============================`);
// branch auschecken
run(`git checkout ${branch}`);
// Rebase
run(`git rebase ${base}`);
console.log(`✅ OK: ${branch} rebased on ${base}`);
}
// zurück zum Start-Branch
if (startBranch) {
run(`git checkout ${startBranch}`);
}
console.log('\n🎉 Fertig.');
}
main();