Skip to content

Example of an automated synchronization of Git remote repositories by Convention over Git.

Notifications You must be signed in to change notification settings

it3xl/convention-over-git

Repository files navigation

Pure Git with Convention over Git

Automated synchronization of remote Git repositories by pure Git and Convention-over-Git.


Consider to use git-repo-sync, the next generation of remote Git repositories synchronization solutions.


This approach uses well-known Git tools. It is because Git has an innate ability to do this. All we need to add is some convention.

How to use

In a terminal (console) navigate to the project's root folder and run the script

bash run.sh

Windows users have to use Git Bash that comes with any Git installation.

In sample_repos folder, you will find prepared (emulated) local and remote repositories with some commits and branches. Commit somthing or do a merge in any "local repository" and do the Git push. Then run

bash run.sh

again to see changes migrated between remote repositories.

Use in Production

Go to repo_settings folder and create there a file with your syncing repositories' settings.
Use sample_repo.sh file as an example.

Then run

bash run.sh your_file_for_repo_settings.sh

Repeat this run when you want to synchronize your remote repositories.

What is this all about!

Convention over Git is a straightforward approach for an automatic synchronization between Git remote repositories. Absolutely separate remote repositories will begin behave as a single remote repository.

This approach uses well-known Git tools. It is because Git has an innate ability to do this. All we need to add is some convention.

Also you can see code explanation in Cheat-sheet for implementation

Glossary

Glossary

Features

  • Synchronizations of git-tags was eliminated to allow GitLab block them freelly.
  • It is impossible to delete branch of another side. Such branches will be restored.
  • Auto conflict resolving by Convention over Git (non-fast-forward branch conflicts).
  • Prevention of an occasional deletion of an entire repository.
  • Failover & auto recovery of synchronization. Especially for network troubles.
  • Solution is applied per-repository (vs per-server)
  • It has been downgraded here to use two remote Git repositories for clarity, but it can work with many.
  • Bare Git repositories are used for synchronization.

Limitations

  • Do only a single commit to another repository side per the synchronization interval.

Releases

No releases published

Packages

No packages published