On 23/08/2023 02:27, Michael Kjörling wrote:
I know of rsync's shortcomings in the bidirectional-sync use case
because I looked for a good while for a way to get it to do that
safely, before coming across unison which being designed for that
solved that problem with for all intents and purposes no fuss at all.

Almost every version control system (besides legacy ones, e.g. RCS) is designed to combine changes from multiple working copies evolving in parallel.

Of course, git facilities allows to synchronize multiple repositories with minimal risk to loose changes committed to any copy. The idea has been posted in this thread already, see
Sven Joachim. Tue, 22 Aug 2023 17:28:40 +0200.
https://lists.debian.org/msgid-search/87h6orf653....@turtle.gmx.de
setup an "upstream" *bare* repository that may reside on the same machine or accessed through ssh and add it using "git remote" to existing working copies (new ones created by "git clone" will have it).

You may need to set tracking for existing branches. Generally you may follow guides for git hosting services, some open source projects have their own introductions for git novices. You may e.g. choose a branch per working copy to be able to combine commits from any of them. Balance of "git merge" and "git rebase" is mater of taste in respect to linear commit history.

A policy for a *backup* repository may be different from an "upstream" one. Backup repositories should allow to recover after accidental force push to some old commit. Warning: "git push --mirror" does force push at least by default, use it with care. You may either fetch or push to backup repository depending on current working directory. When used properly, it is safer than general purpose synchronizing tools.

A single branch may be pushed to an "upstream" or a "backup" repository without permanently adding it as a remote by specifying path to that repository

    git push user@host:/path/to/repository.git master

I would limit usage of rsync and similar tools to rather specific cases when git repositories are involved:
- copy data when you are going to decommission a disk
- working copy contains untracked files having some value or temporary branches undesired in upstream and backup repositories.

Reply via email to