Git your game on!
The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:
Git Your Game On
Githug is designed to give you a practical way of learning git. It has a series of levels, each requiring you to use git commands to arrive at a correct answer.
Githug should work on Linux, OS X and Windows.
Githug requires Ruby 1.8.7 or higher.
You can check which version of Ruby is installed with the following command:
If ruby is not installed, follow the installation instructions on ruby-lang.org.
To install Githug, run
gem install githug
If you get a complaint about permissions, you can rerun the command with
sudo gem install githug
After the gem is installed change directory to the location where you want the game-related assets to be stored. Then run
You will be prompted to create a directory.
No githug directory found, do you wish to create one? [yn]
y(yes) to continue,
n(no) to cancel and quit Githug.
Githug has 4 game commands:
The change log is available on the wiki. Change log
To suggest a level or create a level that has been suggested, check out the wiki.
Get yourself on the contributors list by doing the following:
lib/githug/level.rbin a position that makes sense (the "commit" level after the "add" and "init" levels for example)
Githug has a DSL for writing levels. Here is an example:
difficulty 1 description "There is a file in your folder called README, you should add it to your staging area"
setup do repo.init FileUtils.touch("README") end
solution do return false unless repo.status.files.keys.include?("README") return false if repo.status.files["README"].untracked
hint do puts "You can type
gitin your shell to get a list of available git commands" end
You can include multiple hints like this:
hints [ "You can type `git` in your shell to get a list of available git commands", "Check the man for `git add`"]
setupwill remove all files from the game folder. You do not need to include a setup method if you don't want an initial git repository (if you are testing
git initor only checking an answer.)
You can call
repo.initto initialize an empty repository.
All methods called on
repoare sent to the grit gem if the method does not exist, and you can use that for most git related commands (
Another method exists called
init_from_leveland it is used like so:
setup do init_from_level end
This will copy the contents of a repository specified in the levels folder for your level. For example, if your level is called "merge" then it will copy the contents of the "merge" folder. It is recommended that you perform the following steps:
After doing this, your level should be able to copy the contents from that git repository and use those for your level. See the "blame" level for an example of this.
The easiest way to test a level is:
githug reset PATH_TO_YOUR_LEVEL
githug test PATH_TO_YOUR_LEVEL
Please note that the
githug testcommand can be run as
githug test --errorsto get an error stack trace from your solve method.
It would be ideal if you add an integration test for your level. These tests live in
spec/githug_specand must be run in order. If you add a level but do not add a test, please add a simple
skip_leveltest case similar to the