Skip to main content

A language-agnostic dependency manager using Git.

Project description

Unix: [![Build Status](https://travis-ci.org/jacebrowning/gitman.svg?branch=develop)](https://travis-ci.org/jacebrowning/gitman) Windows: [![Windows Build Status](https://img.shields.io/appveyor/ci/jacebrowning/gitman/develop.svg)](https://ci.appveyor.com/project/jacebrowning/gitman)<br>Metrics: [![Coverage Status](https://img.shields.io/coveralls/jacebrowning/gitman/develop.svg)](https://coveralls.io/r/jacebrowning/gitman) [![Scrutinizer Code Quality](https://img.shields.io/scrutinizer/g/jacebrowning/gitman.svg)](https://scrutinizer-ci.com/g/jacebrowning/gitman/?branch=develop)<br>Usage: [![PyPI Version](https://img.shields.io/pypi/v/GitMan.svg)](https://pypi.org/project/GitMan)

# Overview

GitMan is a language-agnostic dependency manager using Git. It aims to serve as a submodules replacement and provides advanced options for managing versions of nested Git repositories.

![demo](https://raw.githubusercontent.com/jacebrowning/gitman/develop/docs/demo.gif)

# Setup

## Requirements

* Python 3.5+
* Git 2.8+ (with [stored credentials](http://gitman.readthedocs.io/en/latest/setup/git/))

## Installation

Install GitMan with pip:

```sh
$ pip install gitman
```

or directly from the source code:

```sh
$ git clone https://github.com/jacebrowning/gitman.git
$ cd gitman
$ python setup.py install
```

## Configuration

Generate a sample config file:

```sh
$ gitman init
```

or manually create one (`gitman.yml` or `.gitman.yml`) in the root of your working tree:

```yaml
location: vendor/gitman
sources:
- name: framework
repo: https://github.com/kstenerud/iOS-Universal-Framework
rev: Mk5-end-of-life
- name: coverage
repo: https://github.com/jonreid/XcodeCoverage
rev: master
link: Tools/XcodeCoverage
- name: trufflehog
repo: https://github.com/dxa4481/truffleHog
rev: master
scripts:
- chmod a+x truffleHog.py
- name: fontawesome
repo: https://github.com/FortAwesome/Font-Awesome
sparse_paths:
- fonts/*
rev: master
```

Ignore the dependency storage location:

```sh
$ echo vendor/gitman >> .gitignore
```

# Usage

See the available commands:

```sh
$ gitman --help
```

## Updating Dependencies

Get the latest versions of all dependencies:

```sh
$ gitman update
```

which will essentially:

1. Create a working tree at `<root>`/`<location>`/`<name>`
2. Fetch from `repo` and checkout the specified `rev`
3. Symbolically link each `<location>`/`<name>` from `<root>`/`<link>` (if specified)
4. Repeat for all nested working trees containing a config file
5. Record the actual commit SHAs that were checked out (with `--lock` option)
6. Run optional post-install scripts for each dependency

where `rev` can be:

* all or part of a commit SHA: `123def`
* a tag: `v1.0`
* a branch: `master`
* a `rev-parse` date: `'develop@{2015-06-18 10:30:59}'`

## Restoring Previous Versions

Display the specific revisions that are currently installed:

```sh
$ gitman list
```

Reinstall these specific versions at a later time:

```sh
$ gitman install
```

## Deleting Dependencies

Remove all installed dependencies:

```sh
$ gitman uninstall
```

# Revision History

## 1.5 (2018-09-08)

- Added `--keep-location` option on `uninstall` (@DavidWatkins).
- Added feature to enable sparse checkouts. See the docs for further information. (@xenji)
- **BREAKING**: Removed confusing `--lock` option on `update` command in favor of just using the `lock` command.
- **BREAKING**: Renamed `--no-lock` to `--skip-lock` on `update` command.
- **BREAKING**: Renamed `--no-dirty` to `--fail-if-dirty` on `list` command.

## 1.4 (2017-03-21)

- Allow config files to exist in subdirectories of the main project.
- Added `${GITMAN_CACHE}` to customize the repository cache location.

## 1.3 (2017-02-03)

- Added `init` command to generate sample config files.
- Added support for post-install scripts on dependencies.
- Updated config format to support `null` for links.

## 1.2 (2017-01-08)

- Added preliminary Windows support (@StudioEtrange).

## 1.1 (2017-01-06)

- Added coloring to the command-line output.
- Fixed issue where `<dirty>` could be saved as a locked revision.

## 1.0.2 (2016-07-28)

- Moved documentation to http://gitman.readthedocs.io/.

## 1.0.1 (2016-05-31)

- Replaced calls to `git remote add origin` with `git remote set-url origin`.

## 1.0 (2016-05-22)

- Initial stable release.

## 0.11 (2016-05-10)

- Removed dependency on `sh` to support Cygwin/MinGW/etc. on Windows.
- Dropped Python 3.4 support for `subprocess` and `*args` improvements.
- **BREAKING**: Renamed config file key `dir` to `name`.

## 0.10 (2016-04-14)

- Added `show` command to display dependency and internal paths.

## 0.9 (2016-03-31)

- Added `edit` command to launch the config file.
- Depth now defaults to 5 to prevent infinite recursion.
- Fixed handling of source lists containing different dependencies.

## 0.8.3 (2016-03-14)

- Renamed to GitMan.

## 0.8.2 (2016-02-24)

- Updated to YORM v0.6.

## 0.8.1 (2016-01-21)

- Added an error message when attempting to lock invalid repositories.

## 0.8 (2016-01-13)

- Switched to using repository mirrors to speed up cloning.
- Disabled automatic fetching on install.
- Added `--fetch` option on `install` to always fetch.
- Now displaying `git status` output when there are changes.

## 0.7 (2015-12-22)

- Fixed `git remote rm` command (@hdnivara).
- Now applying the `update` dependency filter to locking as well.
- Now only locking previous locked dependencies.
- Added `lock` command to manually save all dependency versions.
- Now requiring `--lock` option on `update` to explicitly lock dependencies.

## 0.6 (2015-11-13)

- Added the ability to filter the dependency list on `install` and `update`.
- Added `--depth` option to limit dependency traversal on `install`, `update`, and `list`.

## 0.5 (2015-10-20)

- Added Git plugin support via: `git deps`.
- Removed `--no-clean` option (now the default) on `install` and `update`.
- Added `--clean` option to delete ignored files on `install` and `update`.
- Switched to `install` rather than `update` of nested dependencies.
- Added `--all` option on `update` to update all nested dependencies.
- Disabled warnings when running `install` without locked sources.
- Added `--no-lock` option to disable version recording.

## 0.4.2 (2015-10-18)

- Fixed crash when running with some sources missing.

## 0.4.1 (2015-09-24)

- Switched to cloning for initial working tree creation.

## 0.4 (2015-09-18)

- Replaced `install` command with `update`.
- Updated `install` command to use locked dependency versions.
- Now sorting sources after a successful `update`.
- Now requiring `--force` to `uninstall` with uncommitted changes.
- Updated `list` command to show full shell commands.

## 0.3.1 (2015-09-09)

- Ensures files are not needlessly reloaded with newer versions of YORM.

## 0.3 (2015-06-26)

- Added `--no-clean` option to disable removing untracked files.
- Added support for `rev-parse` dates as the dependency `rev`.

## 0.2.5 (2015-06-15)

- Added `--quiet` option to hide warnings.

## 0.2.4 (2015-05-19)

- Now hiding YORM logging bellow warnings.

## 0.2.3 (2015-05-17)

- Upgraded to YORM v0.4.

## 0.2.2 (2015-05-04)

- Specified YORM < v0.4.

## 0.2.1 (2015-03-12)

- Added automatic remote branch tracking in dependencies.
- Now requiring `--force` when there are untracked files.

## 0.2 (2015-03-10)

- Added `list` command to display current URLs/SHAs.

## 0.1.4 (2014-02-27)

- Fixed an outdated index when checking for changes.

## 0.1.3 (2014-02-27)

- Fixed extra whitespace when logging shell output.

## 0.1.2 (2014-02-27)

- Added `--force` argument to:
- overwrite uncommitted changes
- create symbolic links in place of directories
- Added live shell command output with `-vv` argument.

## 0.1 (2014-02-24)

- Initial release.


Project details


Release history Release notifications | RSS feed

This version

1.5

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

GitMan-1.5.tar.gz (136.3 kB view hashes)

Uploaded Source

Built Distribution

GitMan-1.5-py3-none-any.whl (37.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page