Read the statement by Michael Teeuw here.
MagicMirror-backup-restore
-
@rkorell thanks.
Hm.
If I git remote on the backup folder.
And git branch on the folder and
they are different what do you think I should doWhat is the right branch?
-
Dear Sam, @sdetweil ,
sorry for the late reply — time zones 😊 (it was night here in Germany when you posted).
To answer your question: the right branch is main.
That’s where mm_backup.sh pushes to
(git push -f origin main) , and that’s where backups should live.The problem is that mm_restore.sh creates and checks out a “restore”-branch but never switches back (to main) or deletes “restore” afterwards. So after a restore, the local repo stays on restore-branch.
When mm_backup.sh runs next, it does git add and git commit — which goes to the currently checked-out branch (restore-branch), but then pushes main. So the new backup commit is “lost” on the wrong branch.
I think the simplest fix would be to add a git checkout main at the beginning of mm_backup.sh,
before any git operations. That way it always commits to the right branch regardless of what
happened before.Alternatively, mm_restore.sh could clean up after itself by switching back to main and deleting
restore-branch when it’s done.Thanks for looking into it!
Warmest regards,
Ralf -
@rkorell no sorry needed. We all respond when we can
Got it. Both scripts are broken
Backup for not checking and correcting
Restore for not cleaning up -
@sdetweil OK; cool! Thanks again for all your effort!
Warmest regards,
Ralf -
@rkorell I have pushed fixes for both scripts to handle this error in the previous versions…
both backup and restore will handle the case where the restore-branch exists (as now)
and cleanup after…thanks for the report and feedback
-
@sdetweil resolved in less than 24 hours :-) This is “responsive” !
Thanks again!
Ralf
