Skip to main content

GitManager

Build Status PyPI version

A script that can handle multiple Git repositories locally. Written in Python, supports version 3.5 and upwards.

Installation

Make sure python is installed, then run

# install from a clone of the repository
python setup.py install

or

# install from PyPi
pip install git_manager

to install the package. This will make it available by running git-manager (or git manager).

Configuration

Git Manager can be configured through its configuration file. In order, it looks for the configuration file in the following locations:

  1. $GIT_MANAGER_CONFIG (if set)

  2. ~/.config/.gitmanager/config (or $XDG_CONFIG_HOME/.gitmanager/config if set)

  3. ~/.gitmanager

The configuration file is parsed line-by-line and declares which repositories are under GitManager control. It consists of three different types of directives:

  1. Root Line Configure the root folder to clone repositories to automatically. Starts with two hashes, then sets the folder relative to the users home directory. For example:

    ## /opt/repositories
  2. Comments Anything starting with a “#” will be treated as a comment. The same goes for empty (or whitespace-only) lines.

  3. Repository instruction To declare a repository write REPOSITORY_URL [FOLDER]. This declares that the repository from REPOSITORY_URL should be cloned into the folder FOLDER. In case the folder is omitted, the ‘humanish’ part of the URI will be taken automatically. All folder paths by default are relative to the users home folder, but this can be changed with the instruction below. Example:

    # makes the git/git repository available locally
    # in the folder ~/Projects/git
    https://github.com/git/git Projects/git
    
    # makes the GitManager repository available
    # in the folder ~/GitManager
    https://github.com/tkw1536/GitManager
  4. Group Instruction In the case where multiple repositories should be cloned into the same folder, it is inconvenient to always give the full path to that folder in the configuration file. For this reason GitManager supports the concept of a group. A group can be started by prefixing a line with the “>” character. A group takes one argument. A path to a folder all repositories should be cloned into. This is best illustrated in the form of an example:

    # We can create a group to store all our atom-related projects.
    # All repositories are automatically available in the ~/AtomProjects
    # folder.
    > AtomProjects
      https://github.com/atom/atom
      https://github.com/atom/markdown-preview
    
    # makes the GitManager repository available
    # in the folder ~/GitManager
    https://github.com/tkw1536/GitManager

    Groups completely support nesting. A sub-groups path and pattern for origin are relative to the parent group. To create a sub-group, add another “>” character in front of the line.

An example configuration file can be found in the file config_example.

Installing Repositories Locally

Setup

examples/setup.gif

Use git-manager setup [pattern] to clone repositories in the config file to the local disk. Use the optional pattern argument to restrict the reposiories to install.

Clone

examples/clone.gif

Use git-manager clone [--save] url to automatically clone a repository into a location determined by the URL. Use the --save flag to automatically update the config file.

Reconfigure

examples/reconfigure.gif

Use git-manager reconfigure to automatically add repositories found in folder and it’s subdirectories to the configuration file.

Viewing Local Repositories

List

examples/ls.gif

Use git-manager ls [pattern] to list local repositories. Use the optional pattern argument to restrict the repositories to list.

Status

examples/status.gif

Use git-manager status [pattern] to show the status of local repositories. Use the optional pattern argument to restrict the repositories to check.

State

examples/state.gif

Use git-manager state [pattern] to compare local repositories with their remote counterpart. Use the optional pattern argument to restrict the repositories to check.

Updating Local Repositories

Pull

examples/pull.gif

Use git-manager pull [pattern] to run git pull on all repositories installed locally. Use the optional pattern argument to restrict the repositories to pull.

Fetch

Use git-manager fetch [pattern] [args...] to run git fetch on all repositories installed locally. Use the optional pattern argument to restrict the repositories to fetch. Use the optional remaining arguments to pass further arguments to the fetch command.

Push

Use git-manager push [pattern] to run git push on all repositories installed locally. Use the optional pattern argument to restrict the repositories to pull.

GC

Use git-manager gc [pattern] [args...] to run git gc on all repositories installed locally. Use the optional pattern argument to restrict the repositories to garbage collect. Use the optional remaining arguments to pass further arguments to the gc command.

Repository Patterns

Some commands optionally accept the pattern argument. This can be used to filter repository by their name.

Repository patterns are simple glob-like pattern matches on standardized remote URLs. They can also be normal glob patterns on full URLs.

For example:

Pattern

Examples

world

git@github.com:hello/world.git, https://github.com/hello/world

hello/*

git@github.com:hello/earth.git, git@github.com:hello/mars.git

hello/m*

git@github.com:hello/mars.git, git@github.com:hello/mercury.git

github.com/*/*

git@github.com:hello/world.git, git@github.com:bye/world.git

github.com/hello

git@github.com:hello/world.git, git@github.com:hello/mars.git

Development and Testing

This project is unit tested with a high coverage rate. The tests can be run with:

nosetests --with-coverage --cover-package GitManager

Tests are automatically run on Travis CI after every commit.

License

The MIT License (MIT)

Copyright (c) 2016-18 Tom Wiesing

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Metadata

Release files for git_manager 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for git_manager 0.2.0
File Size Uploaded Provenance Actions
git_manager-0.2.0.tar.gz 20.3 kB Without provenance Details for git_manager-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for git_manager 0.2.0
File Interpreter ABI Platform Actions
git_manager-0.2.0-py3-none-any.whl Python 3 none any Details for git_manager-0.2.0-py3-none-any.whl

Total release size: 52.6 kB

Release files / git_manager-0.2.0.tar.gz

Download URL git_manager-0.2.0.tar.gz
Size 20.3 kB
Tags Source
SHA-256 checksum
How to use checksums
13873592d4b82823896b04e7ca6db6afaa7b0e2c56cf9c98667117f7b8c2ba11
BLAKE2b-256 checksum
How to use checksums
97876485d70309f1ddca91735b9372e3d66173e7ceb2e1b86d358aa6925fce2e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / git_manager-0.2.0-py3-none-any.whl

Download URL git_manager-0.2.0-py3-none-any.whl
Size 32.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
65adf712b1248661d82d0363ca5e8b1b9e0743b292922df81636ae814583310c
BLAKE2b-256 checksum
How to use checksums
94af39cdddec137c2769cd4285d718c5595eb43f27530bc74fdcbdd5bc8cf200
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for git_manager 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page