Skip to main content

Generate dummy Git repositories populated with the desired number of commits, branches, and structure.

Project description

git-dummy

GitHub license GitHub tag Downloads Contributors Share

Generate dummy Git repositories and populate them with the desired number of commits, branches, merges, and structure.

Example: $ git-dummy --commits=10 --branches=4 --merge=1

This will initialize a new Git repo in the current directory with 4 branches, each containing 10 commits, 1 of which is merged back into main.

Note: All generated dummy repos have at minimum 1 branch called main. For dummies with multiple branches, branches are named branch1, branch2, ..., branchN. Each branch currently branches off of main at --diverge-at if supplied, or else a randomly chosen commit. The length of each branch is capped at the number of commits specified by --commits. Use --merge=x,y,...,n to select which branches get merged back into main.

Use cases

  • Programatically generate Git repos for functional testing of Git tools
  • Decide how many commits and branches are generated
  • Select which branches get merged back into main
  • Mimic scenarios in real Git repos to practice on without touching real data
  • Generate Git demo repos to teach or learn from

Features

  • Run a one-liner git-dummy command in the terminal to generate a dummy Git repo based on your parameters
  • Customize the repo name, path, number of commits, branches, merges, and structure

Quickstart

  1. Install git-dummy:
$ pip install git-dummy
  1. Browse to the directory you want to create your dummy Git repo in:
$ cd path/to/dummy/parent
  1. Run the program:
$ git-dummy [options]
  1. A new Git repo called dummy will be initialized and populated based on the supplied parameters.

  2. See global help for list of global options/flags and subcommands:

$ git-dummy -h

Requirements

  • Python 3.7 or greater
  • Pip (Package manager for Python)

Command options and flags

Available options and flags include:

--name: The name of the dummy Git repo, defaults to "dummy".
--commits: The number of commits to populate in the dummy Git repo, defaults to 5.
--branches: The number of branches to generate in the dummy Git repo, defaults to 1.
--diverge-at: The commit number at which branches diverge from main.
--merge: A comma separated list of branch postfix ids to merge back into main.
--git-dir: The path at which to store the dummy Git repo, defaults to current directory.
--no-subdir: Initialize the dummy Git repo in the current directory instead of in a subdirectory.
--constant_sha: Use constant values for commit author, email, and commit date parameters to yield consistent sha1 values across git-dummy runs.

Command examples

Generate a dummy Git repo called "cheese" on your Desktop, with 2 branches and 10 commits on each branch:

$ git-dummy --name=cheese --branches=2 --commits=10 --git-dir=~/Desktop

Generate a dummy repo with 4 branches main, branch1, branch2, and branch3. Branches diverge from main after the 2nd commit:

$ git-dummy --branches=4 --diverge-at=2

Generate a dummy repo with 4 branches, so that branch1 and branch3 are merged back into main:

$ git-dummy --branches=4 --merge=1,3

For convenience, environment variables can be set for any command-line option available in git-dummy. All environment variables start with git_dummy_ followed by the name of the option.

For example, the --git-dir option can be set as an environment variable like:

$ export git_dummy_git_dir=~/Desktop

Similarly, the --name option can be set like:

$ export git_dummy_name=cheese

In general:

$ export git_dummy_option_name=option_value

Explicitly specifying options at the command-line takes precedence over the corresponding environment variable values.

Learn More

Learn more about this tool on the git-dummy project page.

Authors

Jacob Stopak - on behalf of Initial Commit

Project details


Download files

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

Source Distribution

git-dummy-0.1.0.tar.gz (11.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

git_dummy-0.1.0-py3-none-any.whl (12.6 kB view details)

Uploaded Python 3

File details

Details for the file git-dummy-0.1.0.tar.gz.

File metadata

  • Download URL: git-dummy-0.1.0.tar.gz
  • Upload date:
  • Size: 11.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.1

File hashes

Hashes for git-dummy-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f63451218950f77c23382b0bc726faffb5b87bc0a7a614c5b49f6c94e1f276b3
MD5 8e4f6ba783090c9eac4c39add87074d2
BLAKE2b-256 d466980135e616855b6e33a875b0c42112a966f07da18d1bbb2dd002199fa3de

See more details on using hashes here.

File details

Details for the file git_dummy-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: git_dummy-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.1

File hashes

Hashes for git_dummy-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 84db224e49985f1aa1b6124d6e2b4f125bc6be5a0f80101dfc1e670eef26d2cd
MD5 eafd7a7ec78da27a8948e97864df0f58
BLAKE2b-256 34526d4132f441cc748a2c12f71d6befe4541252058e3a6564611ea793830b38

See more details on using hashes here.

Supported by

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