Skip to content

Commit 62e9f88

Browse files
Update readme and setup
Signed-off-by: Jacob Stopak <jacob@initialcommit.io>
1 parent 843bdc4 commit 62e9f88

File tree

2 files changed

+101
-78
lines changed

2 files changed

+101
-78
lines changed

README.md

Lines changed: 99 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
11
# git-sim
2-
Simulate git commands on your own repos by generating a .mp4 visualization before running the actual command.
2+
Simulate Git commands on your own repos by generating an image (default) or video visualization depicting the command's behavior.
33

44
## Use cases
5-
- Visualizing Git commands before running them to understand the effect
6-
- Sharing desired parts of your workflow with your team
7-
- Creating animated Git videos for blog posts or YouTube
8-
- Helping newer developers learn Git
5+
- Visualize Git commands to understand their effects on your repo before actually running them
6+
- Share visualizations of your Git workflow with your team, or the world
7+
- Create static Git diagrams or dynamic animated videos for your content
8+
- Save visualizations as a part of your teams documentation to prevent recurring issues
9+
- Help newer developers learn Git
910

1011
## Features
11-
- Run a one-liner git-sim command in the terminal to generate a custom Git command visualization (.mp4) in your repo
12-
- Speed up or slow down animation speed as desired
13-
- Add custom branded intro/outro sequences if desired
12+
- Run a one-liner git-sim command in the terminal to generate a custom Git command visualization (.jpg) from your repo
13+
- Supported commands: `status`, `add`, `branch`, `tag`, `reset`, `revert`
14+
- Generate an animated video (.mp4) instead of a static image using the `--animate` flag (note: significant performance slowdown)
1415
- Choose between dark mode (default) and light mode
16+
- Animation only: Add custom branded intro/outro sequences if desired
17+
- Animation only: Speed up or slow down animation speed as desired
1518

1619
## Commands
17-
18-
Basic usage is similar to Git itself - `git-sim` takes a familiar set of subcommands such as "add", "reset", "branch", "merge", etc, along desired options.
20+
Basic usage is similar to Git itself - `git-sim` takes a familiar set of subcommands such as "status", "add", "commit", "branch", "reset", "revert", etc, along with corresponding options.
1921

2022

2123
```console
@@ -24,8 +26,11 @@ $ git-sim [global options] <subcommand> [subcommand options]
2426

2527
The `[global options]` apply to the overarching `git-sim` simulation itself, including:
2628

27-
`--speed=n`: Set the multiple of animation speed of the output simulation, `n` can be an integer or float, default is 1.
2829
`--light-mode`: Use a light mode color scheme instead of default dark mode.
30+
`--animate`: Instead of outputting a static image, animate the Git command behavior in a .mp4 video.
31+
32+
Animation-only global options (to be used in conjunction with `--animate`:
33+
`--speed=n`: Set the multiple of animation speed of the output simulation, `n` can be an integer or float, default is 1.
2934
`--low-quality`: Render the animation in low quality to speed up creation time, recommended for non-presentation use.
3035
`--show-intro`: Add an intro sequence with custom logo and title.
3136
`--show-outro`: Add an outro sequence with custom logo and text.
@@ -36,16 +41,46 @@ The `[global options]` apply to the overarching `git-sim` simulation itself, inc
3641

3742
The `[subcommand options]` are like regular Git options specific to the specified subcommand (see below for a full list).
3843

39-
The following is a list of Git commands that can be simulated and their options.
44+
The following is a list of Git commands that can be simulated and their corresponding options/flags.
4045

41-
### git reset
46+
### git status
47+
Usage: `git-sim status`
48+
49+
- Simulated output will show the state of the working directory, staging area, and untracked files
50+
- Note that simulated output will also show the most recent 5 commits on the active branch
51+
52+
### git add
53+
Usage: `git-sim add --name=<file>`
54+
55+
- Specify <file> as a *modified* working directory file, or an untracked file
56+
- Simulated output will show files being moved to the staging area
57+
- Note that simulated output will also show the most recent 5 commits on the active branch
58+
59+
### git branch
60+
Usage: `git-sim branch --name=<new-branch>`
61+
62+
- Specify <new-branch> as the name of the new branch to simulate creation of
63+
- Simulated output will show the newly create branch ref along with most recent 5 commits on the active branch
4264

65+
### git tag
66+
Usage: `git-sim tag --name=<new-tag>`
67+
68+
- Specify <new-tag> as the name of the new tag to simulate creation of
69+
- Simulated output will show the newly create tag ref along with most recent 5 commits on the active branch
70+
71+
### git reset
4372
Usage: `git-sim reset --commit=<reset-to> [--mixed|--soft|--hard]`
4473

4574
- Specify <reset-to> as any commit id, branch name, tag, or other ref to simulate reset to from the current HEAD (default: `HEAD`)
46-
- As with a normal git reset command, Default reset mode is `--mixed`, but can be specified as desired using `--mixed`, `--soft`, or `--hard`
47-
- Simulated command animation will be placed in the path `./git-sim_media/GitSim.mp4`
48-
- Simulated command animation will show branch resets and resulting state of the working directory, staging area, and whether any file changes would be deleted by running the actual command.
75+
- As with a normal git reset command, default reset mode is `--mixed`, but can be specified as desired using `--mixed`, `--soft`, or `--hard`
76+
- Simulated output will show branch/HEAD resets and resulting state of the working directory, staging area, and whether any file changes would be deleted by running the actual command
77+
78+
### git revert
79+
Usage `git-sim revert --commit=<to-revert>`
80+
81+
- Specify <to-revert> as any commit id, branch name, tag, or other ref to simulate revert for
82+
- Simulated output will show the new commit which reverts the changes from <revert-to>
83+
- Simluated output will include the next 4 most recent commits on the active branch
4984

5085
## Video animation example
5186
https://user-images.githubusercontent.com/49353917/179362209-48748966-6d6c-46ff-9424-b1a7266fc83f.mp4
@@ -55,17 +90,12 @@ https://user-images.githubusercontent.com/49353917/179362209-48748966-6d6c-46ff-
5590
* Pip (Package manager for Python)
5691
* [Manim (Community version)](https://www.manim.community/)
5792
* GitPython
93+
* OpenCV
5894

5995
## Quickstart
6096
1) Install [manim and manim dependencies for your OS](https://www.manim.community/)
6197

62-
2) Install GitPython
63-
64-
```console
65-
$ pip3 install gitpython
66-
```
67-
68-
3) Install `git-sim`:
98+
2) Install `git-sim`:
6999

70100
```console
71101
$ pip3 install git-sim
@@ -80,100 +110,93 @@ $ cd path/to/project/root
80110
4) Run the program:
81111

82112
```console
83-
$ git-sim <subcommand> [subcommand options]
113+
$ git-sim [global options] <subcommand> [subcommand options]
84114
```
85115

86-
5) Simulation animations will be created as `.mp4` files. By default, the video
87-
output file is called `GitSim.mp4` and is stored within a subdirectory called `git-sim_media`. The location of this subdirectory is customizeable using the command line flag `--media-dir=path/to/output`.
116+
5) 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 customizeable 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.
88117

89-
6) Use command-line options for customization, see usage:
118+
6) See global help for list of global options/flags and subcommands:
90119

91120
```console
92121
$ git-sim -h
122+
```
93123

94-
usage: git-sim [-h] [--commits COMMITS] [--commit-id COMMIT_ID] [--hide-merged-chains] [--reverse] [--title TITLE] [--logo LOGO] [--outro-top-text OUTRO_TOP_TEXT]
95-
[--outro-bottom-text OUTRO_BOTTOM_TEXT] [--show-intro] [--show-outro] [--max-branches-per-commit MAX_BRANCHES_PER_COMMIT] [--max-tags-per-commit MAX_TAGS_PER_COMMIT]
96-
[--media-dir MEDIA_DIR] [--low-quality] [--light-mode] [--invert-branches]
97-
98-
optional arguments:
99-
-h, --help show this help message and exit
100-
--commits COMMITS The number of commits to display in the Git animation (default: 8)
101-
--commit-id COMMIT_ID
102-
The ref (branch/tag), or first 6 characters of the commit to animate backwards from (default: HEAD)
103-
--hide-merged-chains Hide commits from merged branches, i.e. only display mainline commits (default: False)
104-
--reverse Display commits in reverse order in the Git animation (default: False)
105-
--title TITLE Custom title to display at the beginning of the animation (default: Git Sim, by initialcommit.com)
106-
--logo LOGO The path to a custom logo to use in the animation intro/outro (default: /usr/local/lib/python3.9/site-packages/git_sim/logo.png)
107-
--outro-top-text OUTRO_TOP_TEXT
108-
Custom text to display above the logo during the outro (default: Thanks for using Initial Commit!)
109-
--outro-bottom-text OUTRO_BOTTOM_TEXT
110-
Custom text to display below the logo during the outro (default: Learn more at initialcommit.com)
111-
--show-intro Add an intro sequence with custom logo and title (default: False)
112-
--show-outro Add an outro sequence with custom logo and text (default: False)
113-
--max-branches-per-commit MAX_BRANCHES_PER_COMMIT
114-
Maximum number of branch labels to display for each commit (default: 2)
115-
--max-tags-per-commit MAX_TAGS_PER_COMMIT
116-
Maximum number of tags to display for each commit (default: 1)
117-
--media-dir MEDIA_DIR
118-
The path to output the animation data and video file (default: .)
119-
--low-quality Render output video in low quality, useful for faster testing (default: False)
120-
--light-mode Enable light-mode with white background (default: False)
121-
--invert-branches Invert positioning of branches where applicable (default: False)
122-
--speed SPEED A multiple of the standard 1x animation speed (ex: 2 = twice as fast, 0.5 = half as fast) (default: 1)
123-
```
124-
125-
## Command Examples
126-
Default - draw 8 commits starting from `HEAD`, from oldest to newest:
124+
7) See subcommand help for list of options/flags for a specific subcommand:
127125

128126
```console
129-
$ cd path/to/project/root
130-
$ git-sim
127+
$ git-sit <subcommand> -h
128+
129+
## Basic command examples
130+
Simulate the output of the git status command:
131+
132+
```console
133+
$ cd path/to/git/repo
134+
$ git-sim status
131135
```
132136

133-
Customize the start commit and number of commits, and reverse their display order:
137+
Simulate adding a file to the Git staging area:
134138

135139
```console
136-
$ git-sim --commit-id a1b2c3 --commits=6 --reverse
140+
$ git-sim --light-mode add --name=filename.ext
137141
```
138142

139-
Invert the branch orientation, if multiple branches exist in the commit range:
143+
Simluate creating a new Git branch:
140144

141145
```console
142-
$ git-sim --invert-branches
146+
$ git-sim branch --name=new-branch-name
143147
```
144148

145-
Add an intro with custom title and logo:
149+
Simulate creating a new Git tag:
146150

147151
```console
148-
$ git-sim --commit-id dev --commits=10 --show-intro --title "My Git Repo" --logo path/to/logo.png
152+
$ git-sim tag --name=new-tag-name
149153
```
150154

151-
Add an outro with custom text and logo:
155+
Simulate a hard reset of the current branch HEAD to the previous commit:
152156

153157
```console
154-
$ git-sim --show-outro --outro-top-text "My Git Repo" --outro-bottom-text "Thanks for watching!" --logo path/to/logo.png
158+
$ git-sim reset --commit=HEAD^ --hard
155159
```
156160

157-
Customize the output video directory location:
161+
Simulate reverting the changes in an older commit:
158162

159163
```console
160-
$ git-sim --media-dir=path/to/output
164+
$ git-sim revert --commit=HEAD~7
161165
```
162166

167+
## Command examples with extra options/flags
163168
Use light mode for white background and black text, instead of the default black background with white text:
164169

165170
```console
166-
$ git-sim --light-mode
171+
$ git-sim --light-mode status
172+
```
173+
174+
Animate the simulated output as a .mp4 video file:
175+
176+
```console
177+
$ git-sim --animate add --name=filename.ext
178+
```
179+
180+
Add an intro and outro with custom text and logo (must include `--animate`)
181+
182+
```console
183+
$ git-sim --animate --show-intro --show-outro --outro-top-text="My Git Repo" --outro-bottom-text="Thanks for watching!" --logo=path/to/logo.png status
184+
```
185+
186+
Customize the output image/video directory location:
187+
188+
```console
189+
$ git-sim --media-dir=path/to/output status
167190
```
168191

169-
Generate output video in low quality to speed up rendering time (useful for repeated testing):
192+
Generate output video in low quality to speed up rendering time (useful for repeated testing, must include `--animate`):
170193

171194
```console
172-
$ git-sim --low-quality
195+
$ git-sim --animate --low-quality status
173196
```
174197

175198
## Installation
176-
See **QuickStart** section for details on installing manim and GitPython dependencies. Then run:
199+
See **QuickStart** section for details on installing manim and other dependencies. Then run:
177200

178201
```console
179202
$ pip3 install git-sim

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
version="0.0.1",
99
author="Jacob Stopak",
1010
author_email="jacob@initialcommit.io",
11-
description="Simulate git commands with a visualization before running them",
11+
description="Simulate Git commands on your own repos by generating an image (default) or video visualization depicting the command's behavior.",
1212
long_description=long_description,
1313
long_description_content_type="text/markdown",
1414
url="https://initialcommit.com/tools/git-sim",
@@ -24,7 +24,7 @@
2424
'manim',
2525
'opencv-python',
2626
],
27-
keywords='git sim simulation simulate git-simulate git-simulation git-sim manim animation gitanimation',
27+
keywords='git sim simulation simulate git-simulate git-simulation git-sim manim animation gitanimation image video dryrun dry-run',
2828
project_urls={
2929
'Homepage': 'https://initialcommit.com/tools/git-sim',
3030
},

0 commit comments

Comments
 (0)