| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Visually simulate Git operations in your own repos with a single terminal command.
This generates an image (default) or video visualization depicting the Git command's behavior.
Command syntax is based directly on Git's command-line syntax, so using git-sim is as familiar as possible.
Example: $ git-sim merge <branch>
Note: If you prefer to install git-sim with Docker, skip steps (1) and (2) here and jump to the Docker installation section below, then come back here to step (3).
Install Manim and its dependencies for your OS / environment:
Install git-sim:
$ pip3 install git-simNote: For MacOS, it is recommended to NOT use the system Python to install Git-Sim, and instead use Homebrew to install a version of Python to work with Git-Sim. Virtual environments should work too.
$ cd path/to/git/repo$ git-sim [global options] <subcommand> [subcommand options]Optional: If you don't have an existing Git repo to simulate commands on, use the bundled git-dummy command to generate a dummy Git repo with the desired number of branches and commits to simulate operations on with git-sim:
$ git-dummy --name="dummy-repo" --branches=3 --commits=10
$ cd dummy-repo
$ git-sim [global options] <subcommand> [subcommand options]Or if you want to do it all in a single command:
$ git-dummy --no-subdir --branches=3 --commits=10 && git-sim [global options] <subcommand> [subcommand options]Simulated output will be created as a .jpg file. Output files are named using the subcommand executed combined with a timestamp, and by default are stored in a subdirectory called git-sim_media/. The location of this subdirectory is customizable using the command line flag --media-dir=path/to/output. Note that when the --animate global flag is used, render times will be much longer and a .mp4 video output file will be produced.
For convenience, environment variables can be set for any global command-line option available in git-sim. All environment variables start with git_sim_ followed by the name of the option.
For example, the --media-dir option can be set as an environment variable like:
$ export git_sim_media_dir=~/DesktopSimilarly, the --speed option can be set like:
$ export git_sim_speed=2Boolean flags can be set like:
$ export git_sim_light_mode=trueIn general:
$ export git_sim_option_name=option_valueExplicitly specifying options at the command-line takes precedence over the corresponding environment variable values.
$ git-sim -h$ git-sim <subcommand> -hBasic usage is similar to Git itself - git-sim takes a familiar set of subcommands including "log", "status", "add", "restore", "commit", "stash", "branch", "tag", "reset", "revert", "merge", "rebase", "cherry-pick", along with corresponding options.
$ git-sim [global options] <subcommand> [subcommand options]The [global options] apply to the overarching git-sim simulation itself, including:
--light-mode: Use a light mode color scheme instead of default dark mode.
--animate: Instead of outputting a static image, animate the Git command behavior in a .mp4 video.
--media-dir: The path at which to store the simulated output media files.
-d: Disable the automatic opening of the image/video file after generation. Useful to avoid errors in console mode with no GUI.
--reverse, -r: Display commit history in the reverse direction.
--img-format: Output format for the image file, i.e. jpg or png. Default output format is jpg.
--stdout: Write raw image data to stdout while suppressing all other program output.
Animation-only global options (to be used in conjunction with --animate):
--video-format: Output format for the video file, i.e. mp4 or webm. Default output format is mp4.
--speed=n: Set the multiple of animation speed of the output simulation, n can be an integer or float, default is 1.5.
--low-quality: Render the animation in low quality to speed up creation time, recommended for non-presentation use.
--show-intro: Add an intro sequence with custom logo and title.
--show-outro: Add an outro sequence with custom logo and text.
--title=title: Custom title to display at the beginning of the animation.
--logo=logo.png: The path to a custom logo to use in the animation intro/outro.
--outro-top-text: Custom text to display above the logo during the outro.
--outro-bottom-text: Custom text to display below the logo during the outro.
The [subcommand options] are like regular Git options specific to the specified subcommand (see below for a full list).
The following is a list of Git commands that can be simulated and their corresponding options/flags.
Usage: git-sim log
Usage: git-sim status
Usage: git-sim add <file 1> <file 2> ... <file n>
Usage: git-sim restore <file 1> <file 2> ... <file n>
Usage: git-sim commit -m "Commit message"
Usage: git-sim stash [push|pop|apply] <file>
Usage: git-sim branch <new branch name>
Usage: git-sim tag <new tag name>
Usage: git-sim reset <reset-to> [--mixed|--soft|--hard]
Usage: git-sim revert <to-revert>
Usage: git-sim merge <branch>
Usage: git-sim rebase <new-base>
Usage: git-sim cherry-pick <commit>
$ git-sim --animate reset HEAD^$ git checkout main
$ git-sim --animate merge dev$ git checkout dev
$ git-sim --animate rebase main$ git checkout main
$ git-sim --animate cherry-pick devSimulate the output of the git log command:
$ cd path/to/git/repo
$ git-sim logSimulate the output of the git status command:
$ git-sim statusSimulate adding a file to the Git staging area:
$ git-sim add filename.extSimulate restoring a file from the Git staging area:
$ git-sim restore filename.extSimulate creating a new commit based on currently staged changes:
$ git-sim commit -m "Commit message"Simulate stashing all working directory and staged changes:
$ git-sim stashSimulate creating a new Git branch:
$ git-sim branch new-branch-nameSimulate creating a new Git tag:
$ git-sim tag new-tag-nameSimulate a hard reset of the current branch HEAD to the previous commit:
$ git-sim reset HEAD^ --hardSimulate reverting the changes in an older commit:
$ git-sim revert HEAD~7Simulate merging a branch into the active branch:
$ git-sim merge feature1Simulate rebasing the active branch onto a new base:
$ git-sim rebase mainSimulate cherry-picking a commit from another branch onto the active branch:
$ git-sim cherry-pick 0ae641Use light mode for white background and black text, instead of the default black background with white text:
$ git-sim --light-mode statusAnimate the simulated output as a .mp4 video file:
$ git-sim --animate add filename.extAdd an intro and outro with custom text and logo (must include --animate):
$ git-sim --animate --show-intro --show-outro --outro-top-text="My Git Repo" --outro-bottom-text="Thanks for watching!" --logo=path/to/logo.png statusCustomize the output image/video directory location:
$ git-sim --media-dir=path/to/output statusOptionally, set the environment variable git_sim_media_dir to set a global default media directory, to be used if no --media-dir is provided. Simulated output images/videos will be placed in this location, in subfolders named with the corresponding repo's name.
$ export git_sim_media_dir=path/to/media/directory
$ git-sim statusNote: --media-dir takes precedence over the environment variable. If you set the environment variable and still provide the argument, you'll find the media in the path provided by --media-dir.
Generate output video in low quality to speed up rendering time (useful for repeated testing, must include --animate):
$ git-sim --animate --low-quality statusSee Quickstart section for details on installing manim and other dependencies. Then run:
$ pip3 install git-sim$ git clone https://github.com/initialcommit-com/git-sim.git$ docker build -t git-sim .Optional: On MacOS / Linux / or GitBash in Windows, create an alias for the long docker command so your can run it as a normal git-sim command. To do so add the following line to your .bashrc or equivalent, then restart your terminal:
git-sim() { docker run --rm -v $(pwd):/usr/src/git-sim git-sim "$@" }This will enable you to run git-sim subcommands as described above.
Learn more about this tool on the git-sim project page.
Jacob Stopak - on behalf of Initial Commit
| Back | FazBrowse Home | New Git URL |