learnGitBranching README

The project's README from github.com/pcottle/learnGitBranching. As one markdown file: README.md.

LearnGitBranching

PRs Welcome

LearnGitBranching is a git repository visualizer, sandbox, and a series of educational tutorials and challenges. Its primary purpose is to help developers understand git through the power of visualization (something that's absent when working on the command line). This is achieved through a game with different levels to get acquainted with the different git commands.

You can input a variety of commands into LearnGitBranching (LGB) -- as commands are processed, the nearby commit tree will dynamically update to reflect the effects of each command:

demo-gif

This visualization combined with tutorials and "levels" can help both beginners and intermediate developers polish their version control skills. A quick demo is available here: https://pcottle.github.io/learnGitBranching/?demo

Or, you can launch the application normally here: https://pcottle.github.io/learnGitBranching/

Sandbox Mode

By default the application launches in "sandbox mode" with a basic repository already created. Here you can enter commands and mess around with a repository as much as you like. Keep in mind you can

Sandbox mode can be great for demonstrating something to a friend, but the real learning is with levels...

Levels

Type levels to see the available lessons / challenges (and which ones you have solved so far). Each level series aims to teach some high-level git concept, and each tab of levels separates major worlds of info (like remote repositories versus local).

For some added fun, there is a "git golf" concept where we keep track of how many commands you use to solve each level. See if you can match all of our records!

You can share a link to LearnGitBranching with an arbitrary set of commands that will execute upon load by using the command URL parameter. You will also likely want to disable the intro dialog for this case with the NODEMO url param; here is an example to get started.

Level Builder

You can build levels with the build level command. A dialog will walk you through the process, and at the end it will show you a JSON blob that represents the level you just created. Paste that in a gist or directly into an issue and I can check it out / merge in your changes! You can also share this level directly with friends by having them run import level and paste the JSON in the resulting text field, or simply send them a custom URL with the the gist ID in the parameters, like so: https://pcottle.github.io/learnGitBranching/?gist_level_id=a84407351f9c9f0cb241

Reporting Bugs / Opening Issues

When reporting bugs, try running the command debug_copyTree() in your JS console when in a state just before reproducing a bug. This can avoid having to copy all the commands you used to get into a specific state. (I can then use the importTreeNow command to get to that exact state)

Building yourself / Contributing Functionality

For contributing core functionality in the app, you'll probably want to test your changes at least once before submitting a pull request. That means you'll need the "gulp.js" build tool to build the app:

https://gulpjs.com/docs/en/getting-started/quick-start

You'll also need yarn to download all the dependencies of the project.

The general workflow / steps are below:

git clone <your fork of the repo>
cd learnGitBranching
yarn install

git checkout -b newAwesomeFeature
vim ./src/js/git/index.js # some changes
yarn gulp fastBuild # skips tests and linting, faster build

# after building you can open up your browser to the index.html
open ./index.html
# file generated and see your changes

vim ./src/js/git/index.js # more changes
yarn gulp build # runs tests and lint

git commit -am "My new sweet feature!"
git push
# go online and request a pull

Alternatively, you can also build and run the app in a pre-configured online workspace:

Open in Gitpod Open in Codeanywhere

Other Technical Details

LearnGitBranching is a pretty simple application (from a technical perspective). There's no backend database or any AJAX requests -- it's a 100% clientside application written in JavaScript. The production version (on github.io) literally just serves up an HTML page with some JS and CSS.

Here is the high-level process of the build:

Thus, if you build the app locally, all you have to do in order to run the app is just open up index.html in the root directory of the repo. Pretty simple

Docker

You can run the most recently built stable image with docker run -p 8080:80 ghcr.io/pcottle/learngitbranching:main. Access your environment with at http://localhost:8080/

You can build the app and image with the command: docker build -t ghcr.io/pcottle/learngitbranching:latest. See the Makefile for information on how to build locally with docker.

Some of our amazing contributors

Helpful Folks

A big shoutout to these brave souls for extensively testing our sandbox and finding bugs and/or inconsistencies:

And the following heroes for assisting in translating:

Also huge shoutout for everyone who has put up a pull request that was pulled! Check out the 30+ contributors we have in the Contributors View

And everyone who has reported an issue that was successfully closed!

learnGitBranching (pcottle/learnGitBranching)

Searching Database…

这是什么?LearnGitBranching 是一个交互式的 git 可视化工具和教程,让你练习 git 命令并实时观察提交树的变化。它通过关卡和挑战帮助你学习版本控制,而不只是阅读文档。
这是桌面应用还是在浏览器里使用的程序?这是一个 100% 客户端的 Web 应用,使用 JavaScript 编写,没有后端数据库,也不发起 AJAX 请求。你可以直接在本地打开 index.html,也可以使用 github.io 上的托管版本。
怎样才能让它运行起来?可以直接启动托管版本,也可以克隆仓库,用 yarn 安装依赖,再用 gulp 构建;构建完成后直接在本地打开 index.html 即可。也提供 Docker 镜像。
我只想随便玩玩,需要先构建什么吗?不需要。沙盒模式是默认模式,打开即可使用,并且已经预先设置好一个基础仓库;只有想为核心应用贡献代码时才需要构建。
这适合完全的新手,还是也适合有经验的 git 用户?两者都适合:可视化和分关卡的教程能帮助新手理解 git 的概念,而按命令数计分的 “git golf” 则为中级用户提供了可以优化的目标。
需要特定的操作系统或硬件吗?不需要。它完全在网页浏览器中运行,是一个静态的 HTML/CSS/JS 应用,因此任何装有浏览器的操作系统都能使用;另外还提供官方 Docker 镜像,便于自行部署。
“关卡”和“世界”到底是什么?关卡是一个个独立的课程或挑战,按标签页(即“世界”)分组,每个世界讲解一个高层次的 git 概念,比如本地提交与远程仓库。在应用中输入 “levels” 可以查看你已经完成了哪些关卡。
我能和别人分享某个特定的练习或状态吗?可以。你可以分享永久链接,链接中包含一串在加载时自动执行的命令,通过 command 参数实现;还可以用 NODEMO 参数关闭开场介绍。
我能创建自己的自定义关卡吗?可以。build level 命令会引导你创建关卡,并输出一段 JSON 数据,你可以通过 gist、自定义 URL 分享,也可以提交 pull request 或 issue。
应用如何帮助排查报告的问题?在浏览器的 JS 控制台中运行 debugcopyTree(),会捕获你当前的完整状态;维护者可以用 importTreeNow 重新加载这个状态,从而在不重放你所有命令的情况下复现问题。
Creator
pcottle
Size
30 MB
Stars
34.1K
Updated
CommitOct 15
Age
14y
Commits · 90 Days