Gitの基本操作をドリル形式で学べる『githug』をインストール&実践してみた

きっかけはHIROCASTERさんの上記エントリ。GitHubに関する勉強会の参加予約を入れてたのもあって、事前に少しくらいはGit触れる様にしとこっかな〜(以前少し触ってたけど離れ、Bazaar→Mercurialと来て今は一応Mercurial)と思い、簡単な教材的なものを探していたのもあって『こりゃあちょうどいい!』となったのでした。

導入方法は至って簡単、gemで一発。

$ sudo gem install githug

後は都度『githug』と打てば次に行うべきタスクを提示してくれる。(※困った時には『githug hint』。)

まずはじめにディレクトリ作成から。

$ githug
********************************************************************************
*                                    Githug                                    *
********************************************************************************
No githug directory found, do you wish to create one? [yn]  y
Welcome to Githug

Level: 1
Difficulty: *

Initialize an empty repository

nil
$
$ githug
********************************************************************************
*                                    Githug                                    *
********************************************************************************
Please change into the git_hug directory

レベルが上がった!次は初期化。

$ githug
********************************************************************************
*                                    Githug                                    *
********************************************************************************
Congratulations, you have solved the level

Level: 2
Difficulty: *

There is a file in your folder called README, you should add it to your staging area

nil
$ 

READMEを作ってコミット。

 githug
********************************************************************************
*                                    Githug                                    *
********************************************************************************
Congratulations, you have solved the level

Level: 3
Difficulty: *

The README file has been added to your staging area, now commit it.

nil
$

あなたの名前とメールアドレスを設定せよ。…

$ githug
********************************************************************************
*                                    Githug                                    *
********************************************************************************
Congratulations, you have solved the level

Level: 4
Difficulty: *

Set up your git name and email, this is important so that your commits can be identified

nil
$ 

という感じで続いて行く模様。いっちばん最初に操作を覚える/身に付けるにはちょうど良い教材かも知れないですね。
(一番最初に作成した githug/ ディレクトリを削除すれば、また一から始める事が出来ます。)

  • (追記):githug playででも初期化は可能のようです。
$ githug help
Tasks:
  githug help [TASK]  # Describe available tasks or one specific task
  githug hint         # Get a hint for the current level
  githug play         # Initialize the game
  githug reset        # Reset the current level
  githug test         # Test a level from a file path

$