{"id":16247796,"url":"https://github.com/mbdevpl/ingit","last_synced_at":"2025-08-21T06:32:10.475Z","repository":{"id":29117216,"uuid":"120260307","full_name":"mbdevpl/ingit","owner":"mbdevpl","description":"Tool for managing a large collection of repositories in git.","archived":false,"fork":false,"pushed_at":"2024-12-01T11:41:15.000Z","size":287,"stargazers_count":4,"open_issues_count":2,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-12-15T23:31:40.314Z","etag":null,"topics":["git","jenkins-enabled","repository-management"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mbdevpl.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-02-05T05:44:37.000Z","updated_at":"2024-11-30T23:19:07.000Z","dependencies_parsed_at":"2023-11-19T09:23:14.941Z","dependency_job_id":"c2a9bac8-df17-4ff2-9901-1ed230770880","html_url":"https://github.com/mbdevpl/ingit","commit_stats":null,"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbdevpl%2Fingit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbdevpl%2Fingit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbdevpl%2Fingit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbdevpl%2Fingit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mbdevpl","download_url":"https://codeload.github.com/mbdevpl/ingit/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230494904,"owners_count":18235047,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["git","jenkins-enabled","repository-management"],"created_at":"2024-10-10T14:38:42.397Z","updated_at":"2025-08-21T06:32:10.444Z","avatar_url":"https://github.com/mbdevpl.png","language":"Python","readme":".. role:: bash(code)\n    :language: bash\n\n.. role:: json(code)\n    :language: json\n\n.. role:: python(code)\n    :language: python\n\n\n=====\ningit\n=====\n\nTool for managing a large collection of repositories in git.\n\n.. image:: https://img.shields.io/pypi/v/ingit.svg\n    :target: https://pypi.org/project/ingit\n    :alt: package version from PyPI\n\n.. image:: https://github.com/mbdevpl/ingit/actions/workflows/python.yml/badge.svg?branch=main\n    :target: https://github.com/mbdevpl/ingit/actions\n    :alt: build status from GitHub\n\n.. image:: https://codecov.io/gh/mbdevpl/ingit/branch/main/graph/badge.svg\n    :target: https://codecov.io/gh/mbdevpl/ingit\n    :alt: test coverage from Codecov\n\n.. image:: https://api.codacy.com/project/badge/Grade/477a1bc423f9465bb1ba8caeb895385b\n    :target: https://app.codacy.com/gh/mbdevpl/ingit\n    :alt: grade from Codacy\n\n.. image:: https://img.shields.io/github/license/mbdevpl/ingit.svg\n    :target: NOTICE\n    :alt: license\n\nIf you have 100 git-versioned projects, keeping tabs on everything can be quite troublesome.\n\nThat's where *ingit* comes in. It mimics selected git commands, however you can perform the same\naction on a group of repositories instead of just one.\n\nAdditionally, it has an interactive mode in which you can go over your repositories and quickly\nperform typical suggested actions in each individual repository based on its current status.\n\n.. contents::\n    :backlinks: none\n\n\nOverview\n========\n\n\nBasic usage\n-----------\n\nFor general help, see:\n\n.. code:: bash\n\n    ingit -h\n\n\nFor command-specific help, see:\n\n.. code:: bash\n\n    ingit command -h\n\n\nCommands are of two kinds in general:\n\n*   git-like commands, which work similar to their git versions;\n*   ingit-only commands, which you won't find in git.\n\n\nCurrently available ingit-only commands are:\n\n*   ``ingit summary`` will show summary of repositories registered in ingit;\n*   ``ingit register`` will add an existing git repository to ingit configuration;\n*   ``ingit foreach`` will execute a custom command for each repository.\n\n\nCurrently available git-like commands are:\n\n*   ``ingit clone`` will mass-clone registered repositories;\n*   ``ingit init`` will mass-init registered repositories;\n*   ``ingit fetch`` will mass-fetch existing registered repositories;\n*   ``ingit checkout`` will interactively checkout branches;\n*   ``ingit merge`` will interactively merge branches;\n*   ``ingit push`` will mass-push existing registered repositories;\n*   ``ingit gc`` will do mass garbage collection of existing registered repositories;\n*   ``ingit status`` will give comprehensive status report for every existing registered repository.\n\n\nFiltering the repositories\n--------------------------\n\nGit-like commands of ingit\n(namely: ``ingit clone``, ``ingit init``, ``ingit fetch``, ``ingit checkout``,\n``ingit merge``, ``ingit push``, ``ingit gc`` and ``ingit status``),\nas well as ``ingit summary`` and ``ingit foreach``,\nby default operate on all registered repositories.\n\nHowever, they all can take the options ``--regex``/``-r`` and ``--predicate``/``-p``\nthat filter out the repositories using repository metadata (i.e. name, tags, path and remotes)\nwhich is stored in the repositories configuration.\n\nIf both ``--regex``/``-r`` and ``--predicate``/``-p`` are provided,\npredicate is applied first.\n\n\nFiltering repositories by regular expression\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nThe ``--regex``/``-r`` option accepts any regular expression (also a simple string)\nand filters the repos by trying to simply find a match in any of the metadata.\n\nSpecifically, ingit will forward your input regular expression into this function:\n\n.. code:: python\n\n    def regex_predicate(regex, name, tags, path, remotes):\n        return (\n            re.search(regex, name) is not None\n            or any(re.search(regex, tag) is not None for tag in tags)\n            or re.search(regex, str(path)) is not None\n            or any(re.search(regex, name) for name, url in remotes.items()))\n\nThe actual implementation is here: `\u003cingit/runtime.py#L24\u003e`_\n\n\nFiltering repositories by predicate\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nThe ``--predicate``/``-p`` option accepts a python boolean expression which will be inserted\ninto a predicate function template, as below:\n\n.. code:: python\n\n    lambda name, tags, path, remotes: (predicate)\n\nThe actual implementation is here: `\u003cingit/main.py#L266\u003e`_\n\nTherefore, executing ``ingit --predicate \"'python' in tags\" fetch`` results\nin the following predicate being applied:\n\n.. code:: python\n\n    lambda name, tags, path, remotes: ('python' in tags)\n\nAnd thus only repositories that have ``'python'`` in their tags are fetched.\n\n\nConfiguration\n-------------\n\nIngit works based on configuration in 2 JSON files:\n\n*   runtime configuration\n*   repositories configuration\n\nIf either of the files doesn't exist, defaults will be generated.\n\nThe default paths to the files can be overridden via ``--config`` and ``--repos``\ncommand-line options.\n\n\nRuntime configuration\n~~~~~~~~~~~~~~~~~~~~~\n\nMost importantly, stores repositories root directory -- it's a directory which ingit assumes\nto contain git-versioned projects.\n\nExample:\n\n.. code:: json\n\n    {\n      \"description\": \"ingit runtime configuration file\",\n      \"ingit-version\": \"0.4.0\",\n      \"machines\": [\n        {\n          \"name\": \"desktop\",\n          \"repos_path\": \"~/Projects\"\n        },\n        {\n          \"interactive\": false,\n          \"names\": [\"server\", \"server.domain.com\"],\n          \"repos_path\": \"$HOME/Projects\"\n        }\n      ]\n    }\n\n\nRepositories configuration\n~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nIt's a file or multiple files that list all registered projects and keeps their metadata.\n\nThe repositories configuration is automatically updated when ``ingit register`` is used.\n\nExample:\n\n.. code:: json\n\n    {\n      \"description\": \"ingit repositories configuration file\",\n      \"ingit-version\": \"0.4.0\",\n      \"repos\": [\n        {\n          \"name\": \"ingit\",\n          \"remotes\": {\n            \"github\": \"git@github.com:mbdevpl/ingit.git\"\n          },\n          \"tags\": [\n            \"active\",\n            \"git\",\n            \"github\",\n            \"my\",\n            \"python\"\n          ]\n        },\n        {\n          \"name\": \"pylint\",\n          \"remotes\": {\n            \"github\": \"git@github.com:mbdevpl/pylint.git\",\n            \"source\": \"https://github.com/PyCQA/pylint\"\n          },\n          \"tags\": [\n            \"external\",\n            \"github\",\n            \"python\"\n          ]\n        }\n      ]\n    }\n\nEntry of each repository is a JSON object that can have the following fields:\n\n.. code:: json\n\n    {\n      \"name\": \"name of the project\",\n      \"path\": \"path doesn't have to be specified, by default it will be 'repos_path/name'\",\n      \"paths\": {\n        \"machine name 1\": \"path used only on machine 1\",\n        \"machine name 2\": \"path used only on machine 2\",\n        \"\": \"if no machine name is given, the path is used in all other cases\"\n      },\n      \"remotes\": {\n        \"remote name 1\": \"url 1\",\n        \"remote name 2\": \"url 2\"\n      },\n      \"tags\": [\n        \"tags are completely optional\",\n        \"but repositories are much easier to manage if they are consistently tagged\"\n      ]\n    }\n\n\nThe ``repos_path`` mentioned above is taken from the runtime configuration of ingit.\n\nAt most one of ``path`` or ``paths`` is allowed for each repo.\n\nThe two path specifications below are equivalent:\n\n.. code:: json\n\n    {\n      \"name\": \"name of the project\",\n      \"path\": \"some path\"\n    }\n\n.. code:: json\n\n    {\n      \"name\": \"name of the project\",\n      \"paths\": {\n        \"\": \"some path\"\n      }\n    }\n\nOne can provide additional repositories in additional repositories configuration files.\n\nIn order for ingit to detect them, they should be located in ``repos.d`` folder relative to the main\nrepositories configuration file, and follow the same syntax.\n\nExample config structure on Linux that includes 2 additional repositories configuration files:\n\n.. code::\n\n    ~/.config/ingit/\n    .\n    ├── repos.d\n    │   ├── additional_repos_1.json\n    │   └── additional_repos_2.json\n    ├── ingit_config.json\n    └── ingit_repos.json\n\n\nCommand details\n===============\n\nBelow, details of each command are described.\n\n\n``ingit summary``\n-----------------\n\nShow summary of registered repositories and status of configured repository root.\n\nFirst of all, print a list of registered repositories. By default, all\nregistered repositories are listed, but, as in case of most commands, the\nresults can be filtered via a predicate or regex.\n\nIndependently, print a list of all unregistered repositories and all not\nversioned paths present in the configured repositories root.\n\n\n``ingit register``\n------------------\n\nStart tracking a repository in ingit.\n\n.. code:: bash\n\n    ingit register [PATH] [--tags TAG ...]\n\nThe initial configuration is set according to basic repository information:\nits root directory name becomes \"name\" and its currently configured remotes\nbecome \"remotes\". You can edit the configuration manually afterwards.\n\nThe final \"path\" to the repository stored in the configuration depends on the\n``repos_path`` in runtime configuration. The configured \"path\" will be:\n\n*   resolved absolute path if there is no ``repos_path`` configured or\n    repository path is outside of the ``repos_path``;\n*   resolved relative path to the ``repos_path``, if the repository path is\n    within it;\n*   nothing (i.e. not stored) if the if the repository is stored directly in\n    ``repos_path`` (i.e. there are no intermediate directories).\n\nBehaviour of storing relative/no paths in some cases is implemented to make\nconfiguration file much less verbose in typical usage scenarios. To prevent\nthis behaviour, and force all repository paths to be absolute, simply set the\n``repos_path`` in your runtime configuration to JSON ``null``.\n\nUse ``PATH`` to provide the path to root directory of repository.\nIf not provided, current working directory is used.\n\nUse ``--tags`` to provide tags for this repository, they will be added to the\ninitial configuration. Tags have no other effect than making repository\nfiltering easier.\n\n\n``ingit foreach``\n------------------\n\nThe given command is executed in a shell in working directory of each\nproject.\n\nUse ``--timeout`` to set timeout of the command (in seconds).\n\n\n``ingit clone``\n---------------\n\nExecute ``git clone \u003cremote-url\u003e --recursive --origin \u003cremote-name\u003e \u003cpath\u003e``,\nwhere values of ``\u003cpath\u003e`` and ``\u003cremote-...\u003e`` are taken from default remote\nconfiguration of the repository.\n\nAfter cloning, add all remaining configured remotes to the repository and\nfetch them.\n\nFor example, if repository configuration is as follows:\n\n.. code:: json\n\n  {\n    \"name\": \"Spack\",\n    \"path\": \"~/Software/Spack\",\n    \"remotes\": {\n      \"source\": \"https://github.com/spack/spack\",\n      \"github\": \"git@github.com:mbdevpl/spack.git\"\n    },\n    \"tags\": []\n  }\n\nThe clone command will be:\n``git clone https://github.com/spack/spack.git --recursive --origin source ~/Software/Spack``\nbecause ``source`` is the first configured remote.\nThe subsequent commands will be ``git remote add github git@github.com:mbdevpl/spack.git``\nand ``git fetch github``.\n\n\n``ingit init``\n--------------\n\nExecute ``git init`` followed by ``git remote add`` for each configured\nremote.\n\n\n``ingit fetch``\n---------------\n\nExecute ``git fetch \u003cremote-name\u003e``, where the remote name is the remote of\nthe current tracking branch, or all remotes of the repository if there's no\ntracking branch, or repository is in detached head state.\n\nUse ``--all`` to fetch all remotes in all cases.\n\n\n``ingit checkout``\n------------------\n\nInteractively select revision to checkout from list of local branches, remote\nnon-tracking branches and local tags.\n\nThe list of branches to select from is composed by combining:\n\n*   local branches\n*   non-tracking branches on all remotes\n*   local tags\n\nChecking out a remote branch will create a local branch with the same unless\nit already exists. If it already exists, repository will end up in detached\nhead state.\n\nAlso, checking out any tag will put repository in a detached head state.\n\n\n``ingit merge``\n---------------\n\n**Not yet implemented!** The following functionality is intended.\n\nInteractively merge all branches to their tracking branches. For each not\nmerged ``\u003cbranch\u003e``-``\u003ctracking-branch\u003e`` pair, execute\n``git checkout \u003cbranch\u003e`` and then if the merge is fast-forward,\nautomatically execute ``git merge \u003ctracking-branch\u003e --ff-only``. If not, then\nshow more information about the situation of the repository, and propose:\n\n*   ``git merge --log \u003ctracking-branch\u003e``,\n*   ``git rebase -i \u003ctracking-branch\u003e`` and\n*   ``git reset --hard \u003ctracking-branch\u003e``.\n\nIf repository is dirty when this command is executed, do nothing. After work\nis done, return to the originally checked-out branch.\n\n\n``ingit push``\n--------------\n\nExecute ``git push \u003cremote-name\u003e \u003cbranch\u003e:\u003ctracking-branch-name\u003e`` for the\nactive branch.\n\nThe above functionality works, but the following functionality is **not yet implemented**.\n\nUse ``--all`` to execute the push for every branch that has a remote tracking\nbranch.\n\n\n``ingit gc``\n------------\n\nExecute ``git gc --aggressive --prune``.\n\n\n``ingit status``\n----------------\n\nPerform git status, as well as other diagnostic git commands.\n\nExecute:\n\n*   ``git status --short --branch`` to inform about any uncommitted changes,\n*   ``git log tracking_branch..branch`` to inform about commits that are not\n    yet pushed to the remote,\n*   ``git log branch..tracking_branch`` to inform about commits that are not\n    yet merged from the remote.\n\nAdditionally, compare registered remotes with actual remotes to make sure\nthat ingit configuration is in sync with the repository metadata.\n\nUse ``--ignored`` to include ignored files in the status report, just as with\n``git status``.\n\n\nRequirements\n============\n\nPython version 3.10 or later.\n\nPython libraries as specified in `\u003crequirements.txt\u003e`_.\n\nBuilding and running tests additionally requires packages listed in `\u003crequirements_test.txt\u003e`_.\n\nTested on Linux, macOS and Windows.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmbdevpl%2Fingit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmbdevpl%2Fingit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmbdevpl%2Fingit/lists"}