Skip to content

ZachiNachshon/git-deps-syncer

Repository files navigation

License: MIT

RequirementsQuickStartOverviewSupportLicense


git-deps-syncer is a lightweight CLI tool used for syncing git repositories as external source dependencies into any working directory.

It offers a simple alternative to git submodule / subtree by allowing a drop-in-replacement of any git repository as an immutable source dependency that is part of the actual working repository source code, files are located and managed within a dedicated external folder using symlinks.


🏁 Requirements

  • A Unix-like operating system: macOS, Linux
  • git (recommended v2.30.0 or higher)
  • jq (for parsing JSON based config)
  • gh (Optional: GitHub client for opening PRs upon changes)

⚡️ Quick Start

The fastest way (for macOS and Linux) to install git-deps-syncer is using Homebrew:

brew install ZachiNachshon/tap/git-deps-syncer

Alternatively, tap into the formula to have brew search capabilities on that tap formulas:

# Tap
brew tap ZachiNachshon/tap

# Install
brew install git-deps-syncer

For additional installation methods read here.


🔍 Overview

Maintainers / Contributors:


💡 Why Creating git-deps-syncer?

Those are some of the requirements that lead me to implement a custom solution instead of using git submodule / subtree:

  1. Merge any git repository into a working directory source code, treating it as external source dependency
  2. Keep the external source dependencies immutable for changes
  3. Having the external git repositories version controlled
  4. Treat external git repositories as they were standard libraries imports
  5. Having the ability to hot-swap git external dependencies easily with local paths for development

🔬 How Does It Work?

git-deps-syncer is a CLI utility that can be used globally on any directory, though it should mainly be used on a git repository directory. It relies on pre-configured list of git repositories, those are getting fetched and stored within the source code of the working repository within a dedicated unique folder, making them available via symlinks for hot-swap if nessesary.

❗ Note
Every git repository is being cloned into a shared cache directory outside the working directory and its files and folders are being copied without the git index.

Initial Sync

  1. Change directory into a working repository you plan to add the git depdencies

  2. Auto generate a .git-deps/config.json file by running:

    git-deps-syncer init
  3. Edit the .git-deps/config.json file with desired git dependencies

  4. Sync all git external dependencies into the working directory by running:

    git-deps-syncer sync-all
    
    💡 Note
    Add the flag --open-github-pr in order to automatically open a PR based on changes introduced by the sync-all action.
  5. Run git-deps-syncer -h for additional options


📖 Documentation

Please refer to the documentation for detailed explanation on how to configure and use git-deps-syncer.


Support

git-deps-syncer is an open source project that is currently self maintained in addition to my day job, you are welcome to show your appreciation by sending me cups of coffee using the the following link as it is a known fact that it is the fuel that drives software engineering ☕

Buy Me A Coffee


License

MIT