mygithug 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +8 -0
- data/.rspec +2 -0
- data/.travis.yml +18 -0
- data/Gemfile +4 -0
- data/LICENCE.txt +22 -0
- data/README.md +55 -0
- data/Rakefile +6 -0
- data/bin/mygithug +4 -0
- data/levels/add.rb +30 -0
- data/levels/alias_lg.rb +55 -0
- data/levels/alias_st.rb +22 -0
- data/levels/bisect/.githug/COMMIT_EDITMSG +1 -0
- data/levels/bisect/.githug/HEAD +1 -0
- data/levels/bisect/.githug/ORIG_HEAD +1 -0
- data/levels/bisect/.githug/config +7 -0
- data/levels/bisect/.githug/description +1 -0
- data/levels/bisect/.githug/gitk.cache +3 -0
- data/levels/bisect/.githug/hooks/applypatch-msg.sample +15 -0
- data/levels/bisect/.githug/hooks/commit-msg.sample +24 -0
- data/levels/bisect/.githug/hooks/post-commit.sample +8 -0
- data/levels/bisect/.githug/hooks/post-receive.sample +15 -0
- data/levels/bisect/.githug/hooks/post-update.sample +8 -0
- data/levels/bisect/.githug/hooks/pre-applypatch.sample +14 -0
- data/levels/bisect/.githug/hooks/pre-commit.sample +46 -0
- data/levels/bisect/.githug/hooks/pre-rebase.sample +172 -0
- data/levels/bisect/.githug/hooks/prepare-commit-msg.sample +36 -0
- data/levels/bisect/.githug/hooks/update.sample +128 -0
- data/levels/bisect/.githug/index +0 -0
- data/levels/bisect/.githug/info/exclude +6 -0
- data/levels/bisect/.githug/info/refs +9 -0
- data/levels/bisect/.githug/logs/HEAD +21 -0
- data/levels/bisect/.githug/logs/refs/heads/master +21 -0
- data/levels/bisect/.githug/objects/info/packs +2 -0
- data/levels/bisect/.githug/objects/pack/pack-59fab357f3158a9640633de6a3326ed79a2b4fe6.idx +0 -0
- data/levels/bisect/.githug/objects/pack/pack-59fab357f3158a9640633de6a3326ed79a2b4fe6.pack +0 -0
- data/levels/bisect/.githug/packed-refs +10 -0
- data/levels/bisect/makefile +2 -0
- data/levels/bisect/prog.rb +3 -0
- data/levels/bisect/test.rb +4 -0
- data/levels/bisect.rb +15 -0
- data/levels/blame/.githug/COMMIT_EDITMSG +1 -0
- data/levels/blame/.githug/HEAD +1 -0
- data/levels/blame/.githug/config +5 -0
- data/levels/blame/.githug/description +1 -0
- data/levels/blame/.githug/hooks/applypatch-msg.sample +15 -0
- data/levels/blame/.githug/hooks/commit-msg.sample +24 -0
- data/levels/blame/.githug/hooks/post-commit.sample +8 -0
- data/levels/blame/.githug/hooks/post-receive.sample +15 -0
- data/levels/blame/.githug/hooks/post-update.sample +8 -0
- data/levels/blame/.githug/hooks/pre-applypatch.sample +14 -0
- data/levels/blame/.githug/hooks/pre-commit.sample +46 -0
- data/levels/blame/.githug/hooks/pre-rebase.sample +169 -0
- data/levels/blame/.githug/hooks/prepare-commit-msg.sample +36 -0
- data/levels/blame/.githug/hooks/update.sample +128 -0
- data/levels/blame/.githug/index +0 -0
- data/levels/blame/.githug/info/exclude +6 -0
- data/levels/blame/.githug/logs/HEAD +5 -0
- data/levels/blame/.githug/logs/refs/heads/master +5 -0
- data/levels/blame/.githug/objects/00/d6bf5341b263ccaf32e7973be55126eb30a343 +0 -0
- data/levels/blame/.githug/objects/05/07c26fed4d111a8344763be9af68af90f0ecf2 +0 -0
- data/levels/blame/.githug/objects/09/4094808dc6dc336c93c8602190a9e5f7bd6a11 +2 -0
- data/levels/blame/.githug/objects/21/15d78864000292628872941b14521f90187eed +0 -0
- data/levels/blame/.githug/objects/31/11dda1f5b08d50ac44b99acabfa54f1e6e72b0 +2 -0
- data/levels/blame/.githug/objects/50/8db115ba34a0e4e8667653aebe0265bb4f7e80 +0 -0
- data/levels/blame/.githug/objects/5e/8863df752e3b7f2150df7c78f12bef6f1ff00e +0 -0
- data/levels/blame/.githug/objects/67/788a4b90180c7588d7bd0ad8032957b0f429ba +0 -0
- data/levels/blame/.githug/objects/70/d00535a3a25b0ac1736dd3d306d6271e5427ed +0 -0
- data/levels/blame/.githug/objects/97/bdd0cccf9f4b8730f78cb53a81a74f205dbcc2 +1 -0
- data/levels/blame/.githug/objects/ab/08819ba3ffaeba17d4f870dc3a458a904519f4 +0 -0
- data/levels/blame/.githug/objects/be/96fe46de646f6a5c728f90cc884aef96fa1d6f +0 -0
- data/levels/blame/.githug/objects/cd/9c6b9ab1a6f56cccc69b6aa661f1d67ba5fb46 +0 -0
- data/levels/blame/.githug/objects/dd/df1d8ebd60eec169c15a5b23cb49a58d2ed5a0 +4 -0
- data/levels/blame/.githug/objects/ff/d39c2dbfd94bdbca06d48686e0cbda642f3de7 +1 -0
- data/levels/blame/.githug/refs/heads/master +1 -0
- data/levels/blame/config.rb +16 -0
- data/levels/blame.rb +15 -0
- data/levels/branch.rb +18 -0
- data/levels/branch_at.rb +25 -0
- data/levels/checkout.rb +18 -0
- data/levels/checkout_file.rb +25 -0
- data/levels/checkout_tag.rb +39 -0
- data/levels/checkout_tag_over_branch.rb +46 -0
- data/levels/cherry-pick/.githug/COMMIT_EDITMSG +1 -0
- data/levels/cherry-pick/.githug/HEAD +1 -0
- data/levels/cherry-pick/.githug/config +6 -0
- data/levels/cherry-pick/.githug/description +1 -0
- data/levels/cherry-pick/.githug/hooks/applypatch-msg.sample +15 -0
- data/levels/cherry-pick/.githug/hooks/commit-msg.sample +24 -0
- data/levels/cherry-pick/.githug/hooks/post-update.sample +8 -0
- data/levels/cherry-pick/.githug/hooks/pre-applypatch.sample +14 -0
- data/levels/cherry-pick/.githug/hooks/pre-commit.sample +50 -0
- data/levels/cherry-pick/.githug/hooks/pre-rebase.sample +169 -0
- data/levels/cherry-pick/.githug/hooks/prepare-commit-msg.sample +36 -0
- data/levels/cherry-pick/.githug/hooks/update.sample +128 -0
- data/levels/cherry-pick/.githug/index +0 -0
- data/levels/cherry-pick/.githug/info/exclude +6 -0
- data/levels/cherry-pick/.githug/logs/HEAD +14 -0
- data/levels/cherry-pick/.githug/logs/refs/heads/master +4 -0
- data/levels/cherry-pick/.githug/logs/refs/heads/new-feature +6 -0
- data/levels/cherry-pick/.githug/objects/05/aa97588aff673dcf00e0e1b835d6ec6207a7d9 +0 -0
- data/levels/cherry-pick/.githug/objects/14/ad8f1413c40e0e5be6f6cbdec392a783c1d754 +0 -0
- data/levels/cherry-pick/.githug/objects/1b/912962174dd58fbbf1627ec816fa6672c70854 +0 -0
- data/levels/cherry-pick/.githug/objects/22/f99f3abfd02190a760388c8845c190247859fe +0 -0
- data/levels/cherry-pick/.githug/objects/23/2d266a78d5ef7196f1ede14972ccf7ee19e587 +0 -0
- data/levels/cherry-pick/.githug/objects/31/68bdc3ae7e0ab987dda238beab9c0582c7fc07 +0 -0
- data/levels/cherry-pick/.githug/objects/49/4fa3fc1c15986f9a950aba8607da591223614c +0 -0
- data/levels/cherry-pick/.githug/objects/4a/1961bce62840eaef9c4392fe5cc799e38c9b7b +0 -0
- data/levels/cherry-pick/.githug/objects/54/22c2405527c05c23b243b2535a97b6cefa1427 +0 -0
- data/levels/cherry-pick/.githug/objects/54/f3308533fd4400c94c4cd5827cd38036a67a76 +0 -0
- data/levels/cherry-pick/.githug/objects/58/a8c8edcfdd00c6d8cce9aada8f987a1677571f +0 -0
- data/levels/cherry-pick/.githug/objects/6e/dea632d9540e060bca97dda0897df2b7da0ec0 +2 -0
- data/levels/cherry-pick/.githug/objects/85/4e7ac38b3e8df02ea1480ec45aa9e7865f03d7 +0 -0
- data/levels/cherry-pick/.githug/objects/93/3a97260a11a5ee49bb8a4b7b097cb2fb38f85c +0 -0
- data/levels/cherry-pick/.githug/objects/9a/e59e88e6af362c069847e621b971bafff158ac +0 -0
- data/levels/cherry-pick/.githug/objects/a2/14badc644facc4722083aedf91d9339ffdffbf +0 -0
- data/levels/cherry-pick/.githug/objects/b3/0c6a965415df6aef5f2903f9892fa5481152fc +0 -0
- data/levels/cherry-pick/.githug/objects/c6/0c612734f25b9c989d954621491e9ca3c9e061 +0 -0
- data/levels/cherry-pick/.githug/objects/ca/32a6dac7b6f97975edbe19a4296c2ee7682f68 +0 -0
- data/levels/cherry-pick/.githug/objects/cf/d8ce38c22c5fe83cc04e23f94646464f20d990 +0 -0
- data/levels/cherry-pick/.githug/objects/d5/02e68bfe397140e4ac2a819b138545abca604e +0 -0
- data/levels/cherry-pick/.githug/objects/d5/123e58b37fd886dff2b96bfe5ec08a498192aa +0 -0
- data/levels/cherry-pick/.githug/objects/ea/2a47c19b85fc321e2737ddc49db3deeba3a1b5 +0 -0
- data/levels/cherry-pick/.githug/objects/ea/3dbcc5e2d2359698c3606b0ec44af9f76def54 +0 -0
- data/levels/cherry-pick/.githug/refs/heads/master +1 -0
- data/levels/cherry-pick/.githug/refs/heads/new-feature +1 -0
- data/levels/cherry-pick/README.md +2 -0
- data/levels/cherry-pick/hardcore-math.js +3 -0
- data/levels/cherry-pick/nokia.js +1 -0
- data/levels/cherry-pick.rb +19 -0
- data/levels/clone.rb +10 -0
- data/levels/clone_to_folder.rb +10 -0
- data/levels/commit.rb +17 -0
- data/levels/commit_amend.rb +23 -0
- data/levels/commit_in_future.rb +19 -0
- data/levels/config.rb +33 -0
- data/levels/conflict/.githug/COMMIT_EDITMSG +14 -0
- data/levels/conflict/.githug/HEAD +1 -0
- data/levels/conflict/.githug/config +5 -0
- data/levels/conflict/.githug/description +1 -0
- data/levels/conflict/.githug/hooks/applypatch-msg.sample +15 -0
- data/levels/conflict/.githug/hooks/commit-msg.sample +24 -0
- data/levels/conflict/.githug/hooks/post-update.sample +8 -0
- data/levels/conflict/.githug/hooks/pre-applypatch.sample +14 -0
- data/levels/conflict/.githug/hooks/pre-commit.sample +50 -0
- data/levels/conflict/.githug/hooks/pre-rebase.sample +169 -0
- data/levels/conflict/.githug/hooks/prepare-commit-msg.sample +36 -0
- data/levels/conflict/.githug/hooks/update.sample +128 -0
- data/levels/conflict/.githug/index +0 -0
- data/levels/conflict/.githug/info/exclude +6 -0
- data/levels/conflict/.githug/logs/HEAD +12 -0
- data/levels/conflict/.githug/logs/refs/heads/master +4 -0
- data/levels/conflict/.githug/logs/refs/heads/mybranch +5 -0
- data/levels/conflict/.githug/objects/1d/b9aa5013e47f1482ec90323d926171a99c28af +0 -0
- data/levels/conflict/.githug/objects/25/b3f9c339430b35ae5822b2ef90e763284dc007 +0 -0
- data/levels/conflict/.githug/objects/2d/0d90051e320215f54f357e746c9838490557e7 +1 -0
- data/levels/conflict/.githug/objects/30/6868e3258be1f35ae43db71e3a6d7edf42ffe7 +0 -0
- data/levels/conflict/.githug/objects/30/cc28e66966109bb5bfbe96d6c817c367d2050a +0 -0
- data/levels/conflict/.githug/objects/38/21e4362c5a76db1112b46b9210670cd5bab482 +0 -0
- data/levels/conflict/.githug/objects/3c/b65bef44ae724ddf9e89640e7e2754dea1a47f +0 -0
- data/levels/conflict/.githug/objects/3d/7aec017559be2b61cab850dafdcb2b6212f1c3 +1 -0
- data/levels/conflict/.githug/objects/40/e20a455ac2731ad25c297b03aa543d7eedf6ab +0 -0
- data/levels/conflict/.githug/objects/44/30fd3f45c832e685350417600a9862c94d20f1 +0 -0
- data/levels/conflict/.githug/objects/46/677964e679f3e727356d0860c643a12a87902b +0 -0
- data/levels/conflict/.githug/objects/50/a127cb066eb903a6fa59d71802c10cb442fb3b +0 -0
- data/levels/conflict/.githug/objects/55/ad5af2a93afa778971e3d04faf20f6c368b6ba +0 -0
- data/levels/conflict/.githug/objects/6b/0c0b32bdca3af9beb831744cb755d6fdc7c7c0 +2 -0
- data/levels/conflict/.githug/objects/75/179304f4fab00613f08a9412b6cb0965bfa564 +2 -0
- data/levels/conflict/.githug/objects/7c/36daf29660ae4a2f09345427ef76f1d38f902f +0 -0
- data/levels/conflict/.githug/objects/88/e0473c9da347c6311f5f8eca8d256bf25402b6 +2 -0
- data/levels/conflict/.githug/objects/bd/c7bec8acae9b3eabf0a15b223a48211b7a89a1 +2 -0
- data/levels/conflict/.githug/objects/c7/97f979cf24ba148bf10d5e26f5d7402dd5f2e1 +0 -0
- data/levels/conflict/.githug/objects/da/ae380200ed6eeaafd926177018e8ff3009b988 +0 -0
- data/levels/conflict/.githug/refs/heads/master +1 -0
- data/levels/conflict/.githug/refs/heads/mybranch +1 -0
- data/levels/conflict/poem.txt +5 -0
- data/levels/conflict.rb +23 -0
- data/levels/congratulation.rb +10 -0
- data/levels/contribute.rb +25 -0
- data/levels/delete_branch/.githug/COMMIT_EDITMSG +1 -0
- data/levels/delete_branch/.githug/HEAD +1 -0
- data/levels/delete_branch/.githug/config +7 -0
- data/levels/delete_branch/.githug/description +1 -0
- data/levels/delete_branch/.githug/hooks/applypatch-msg.sample +15 -0
- data/levels/delete_branch/.githug/hooks/commit-msg.sample +24 -0
- data/levels/delete_branch/.githug/hooks/post-update.sample +8 -0
- data/levels/delete_branch/.githug/hooks/pre-applypatch.sample +14 -0
- data/levels/delete_branch/.githug/hooks/pre-commit.sample +49 -0
- data/levels/delete_branch/.githug/hooks/pre-push.sample +53 -0
- data/levels/delete_branch/.githug/hooks/pre-rebase.sample +169 -0
- data/levels/delete_branch/.githug/hooks/prepare-commit-msg.sample +36 -0
- data/levels/delete_branch/.githug/hooks/update.sample +128 -0
- data/levels/delete_branch/.githug/index +0 -0
- data/levels/delete_branch/.githug/info/exclude +6 -0
- data/levels/delete_branch/.githug/logs/HEAD +4 -0
- data/levels/delete_branch/.githug/logs/refs/heads/delete_me +1 -0
- data/levels/delete_branch/.githug/logs/refs/heads/master +1 -0
- data/levels/delete_branch/.githug/objects/b6/0afe294eb3c200d646995c9e0234470157c1b0 +2 -0
- data/levels/delete_branch/.githug/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 +0 -0
- data/levels/delete_branch/.githug/objects/e8/0ad49ace82167de62e498622d70377d913c79e +0 -0
- data/levels/delete_branch/.githug/refs/heads/delete_me +1 -0
- data/levels/delete_branch/.githug/refs/heads/master +1 -0
- data/levels/delete_branch/readme +0 -0
- data/levels/delete_branch.rb +15 -0
- data/levels/diff/.githug/COMMIT_EDITMSG +1 -0
- data/levels/diff/.githug/HEAD +1 -0
- data/levels/diff/.githug/config +5 -0
- data/levels/diff/.githug/description +1 -0
- data/levels/diff/.githug/hooks/applypatch-msg.sample +15 -0
- data/levels/diff/.githug/hooks/commit-msg.sample +24 -0
- data/levels/diff/.githug/hooks/post-commit.sample +8 -0
- data/levels/diff/.githug/hooks/post-receive.sample +15 -0
- data/levels/diff/.githug/hooks/post-update.sample +8 -0
- data/levels/diff/.githug/hooks/pre-applypatch.sample +14 -0
- data/levels/diff/.githug/hooks/pre-commit.sample +46 -0
- data/levels/diff/.githug/hooks/pre-rebase.sample +169 -0
- data/levels/diff/.githug/hooks/prepare-commit-msg.sample +36 -0
- data/levels/diff/.githug/hooks/update.sample +128 -0
- data/levels/diff/.githug/index +0 -0
- data/levels/diff/.githug/info/exclude +6 -0
- data/levels/diff/.githug/logs/HEAD +1 -0
- data/levels/diff/.githug/logs/refs/heads/master +1 -0
- data/levels/diff/.githug/objects/1b/6582364621c92707b587409cedbc4f77fc0cee +0 -0
- data/levels/diff/.githug/objects/4f/703ca9bd25781b6758eeb3c42ed5348610ba6d +2 -0
- data/levels/diff/.githug/objects/dc/aa55e97af34402e84d5336da37abcccc23cba6 +3 -0
- data/levels/diff/.githug/refs/heads/master +1 -0
- data/levels/diff/app.rb +42 -0
- data/levels/diff.rb +16 -0
- data/levels/fetch.rb +71 -0
- data/levels/find_old_branch/.githug/COMMIT_EDITMSG +1 -0
- data/levels/find_old_branch/.githug/HEAD +1 -0
- data/levels/find_old_branch/.githug/ORIG_HEAD +1 -0
- data/levels/find_old_branch/.githug/config +6 -0
- data/levels/find_old_branch/.githug/description +1 -0
- data/levels/find_old_branch/.githug/hooks/applypatch-msg.sample +15 -0
- data/levels/find_old_branch/.githug/hooks/commit-msg.sample +24 -0
- data/levels/find_old_branch/.githug/hooks/post-commit.sample +8 -0
- data/levels/find_old_branch/.githug/hooks/post-receive.sample +15 -0
- data/levels/find_old_branch/.githug/hooks/post-update.sample +8 -0
- data/levels/find_old_branch/.githug/hooks/pre-applypatch.sample +14 -0
- data/levels/find_old_branch/.githug/hooks/pre-commit.sample +50 -0
- data/levels/find_old_branch/.githug/hooks/pre-rebase.sample +169 -0
- data/levels/find_old_branch/.githug/hooks/prepare-commit-msg.sample +36 -0
- data/levels/find_old_branch/.githug/hooks/update.sample +128 -0
- data/levels/find_old_branch/.githug/index +0 -0
- data/levels/find_old_branch/.githug/info/exclude +7 -0
- data/levels/find_old_branch/.githug/logs/HEAD +7 -0
- data/levels/find_old_branch/.githug/logs/refs/heads/blowup_sun_for_ransom +1 -0
- data/levels/find_old_branch/.githug/logs/refs/heads/cure_common_cold +2 -0
- data/levels/find_old_branch/.githug/logs/refs/heads/kill_the_batman +4 -0
- data/levels/find_old_branch/.githug/logs/refs/heads/solve_world_hunger +2 -0
- data/levels/find_old_branch/.githug/objects/05/e9c01bd3c9264761dd0cde477400a2c3104642 +0 -0
- data/levels/find_old_branch/.githug/objects/1f/0a136ddd98f61934d15eb00444df32d8e8254b +0 -0
- data/levels/find_old_branch/.githug/objects/32/4336a8401afc8ca384eaafe6615c84d552dd2c +0 -0
- data/levels/find_old_branch/.githug/objects/50/72aab6bd73accec89ad3aa077f43aab8a5e507 +0 -0
- data/levels/find_old_branch/.githug/objects/5d/130caf89f1a4bba6a1fffe72c484f3ab659e08 +0 -0
- data/levels/find_old_branch/.githug/objects/68/76e5b41fb693190df76b1baef6ef98623b4f1a +0 -0
- data/levels/find_old_branch/.githug/objects/6a/7702145d1eb91c9f79583eabb984027b12e60c +0 -0
- data/levels/find_old_branch/.githug/objects/89/4a16d6f1a48224e9006b4a6f0fe3846da19bec +0 -0
- data/levels/find_old_branch/.githug/objects/b8/c67b45e5fe9e4b39ac7ade725673f7c90bdfc3 +0 -0
- data/levels/find_old_branch/.githug/objects/bf/76434bc7e7346c6fef5a98aee0f7cfc0788f34 +0 -0
- data/levels/find_old_branch/.githug/refs/heads/blowup_sun_for_ransom +1 -0
- data/levels/find_old_branch/.githug/refs/heads/cure_common_cold +1 -0
- data/levels/find_old_branch/.githug/refs/heads/kill_the_batman +1 -0
- data/levels/find_old_branch/.githug/refs/heads/solve_world_hunger +1 -0
- data/levels/find_old_branch/TODO +1 -0
- data/levels/find_old_branch/myfile.txt +1 -0
- data/levels/find_old_branch.rb +15 -0
- data/levels/grep/.githug/COMMIT_EDITMSG +1 -0
- data/levels/grep/.githug/HEAD +1 -0
- data/levels/grep/.githug/config +6 -0
- data/levels/grep/.githug/description +1 -0
- data/levels/grep/.githug/hooks/applypatch-msg.sample +15 -0
- data/levels/grep/.githug/hooks/commit-msg.sample +24 -0
- data/levels/grep/.githug/hooks/post-commit.sample +8 -0
- data/levels/grep/.githug/hooks/post-receive.sample +15 -0
- data/levels/grep/.githug/hooks/post-update.sample +8 -0
- data/levels/grep/.githug/hooks/pre-applypatch.sample +14 -0
- data/levels/grep/.githug/hooks/pre-commit.sample +46 -0
- data/levels/grep/.githug/hooks/pre-rebase.sample +169 -0
- data/levels/grep/.githug/hooks/prepare-commit-msg.sample +36 -0
- data/levels/grep/.githug/hooks/update.sample +128 -0
- data/levels/grep/.githug/index +0 -0
- data/levels/grep/.githug/info/exclude +6 -0
- data/levels/grep/.githug/logs/HEAD +1 -0
- data/levels/grep/.githug/logs/refs/heads/master +1 -0
- data/levels/grep/.githug/objects/12/c702f8b25b6b528cf904670b854dba3eba0f45 +3 -0
- data/levels/grep/.githug/objects/6f/45753f4a16b69f5b2215f2dbe8245f073353cc +1 -0
- data/levels/grep/.githug/objects/a4/1fe0c342be5c9930328cbb4315acebbd9c94b2 +0 -0
- data/levels/grep/.githug/objects/d3/f53e82aa015d1eea3b06c3b62dfbacee83bbe1 +0 -0
- data/levels/grep/.githug/refs/heads/master +1 -0
- data/levels/grep/app.rb +45 -0
- data/levels/grep/config.rb +17 -0
- data/levels/grep.rb +14 -0
- data/levels/ignore.rb +42 -0
- data/levels/include.rb +21 -0
- data/levels/init.rb +10 -0
- data/levels/log.rb +22 -0
- data/levels/merge/.githug/COMMIT_EDITMSG +1 -0
- data/levels/merge/.githug/HEAD +1 -0
- data/levels/merge/.githug/config +6 -0
- data/levels/merge/.githug/description +1 -0
- data/levels/merge/.githug/hooks/applypatch-msg.sample +15 -0
- data/levels/merge/.githug/hooks/commit-msg.sample +24 -0
- data/levels/merge/.githug/hooks/post-commit.sample +8 -0
- data/levels/merge/.githug/hooks/post-receive.sample +15 -0
- data/levels/merge/.githug/hooks/post-update.sample +8 -0
- data/levels/merge/.githug/hooks/pre-applypatch.sample +14 -0
- data/levels/merge/.githug/hooks/pre-commit.sample +46 -0
- data/levels/merge/.githug/hooks/pre-rebase.sample +169 -0
- data/levels/merge/.githug/hooks/prepare-commit-msg.sample +36 -0
- data/levels/merge/.githug/hooks/update.sample +128 -0
- data/levels/merge/.githug/index +0 -0
- data/levels/merge/.githug/info/exclude +6 -0
- data/levels/merge/.githug/logs/HEAD +4 -0
- data/levels/merge/.githug/logs/refs/heads/feature +2 -0
- data/levels/merge/.githug/logs/refs/heads/master +1 -0
- data/levels/merge/.githug/objects/ad/24149d789e59d4b5f9ce41cda90110ca0f98b7 +0 -0
- data/levels/merge/.githug/objects/ae/fde3a01f6e10d72fd4899ce14c8b2654d3eb45 +0 -0
- data/levels/merge/.githug/objects/cc/8ea5a233df119d025eb240b9470e1ca76a151c +0 -0
- data/levels/merge/.githug/objects/e1/2277fe88657a072f1c4eb7d9320e4e6a74ba95 +0 -0
- data/levels/merge/.githug/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 +0 -0
- data/levels/merge/.githug/refs/heads/feature +1 -0
- data/levels/merge/.githug/refs/heads/master +1 -0
- data/levels/merge/file1 +0 -0
- data/levels/merge.rb +16 -0
- data/levels/merge_squash.rb +49 -0
- data/levels/number_of_files_committed.rb +51 -0
- data/levels/pull.rb +16 -0
- data/levels/pull_rebase.rb +49 -0
- data/levels/push.rb +67 -0
- data/levels/push_branch.rb +88 -0
- data/levels/push_tags.rb +63 -0
- data/levels/rebase/.githug/COMMIT_EDITMSG +1 -0
- data/levels/rebase/.githug/HEAD +1 -0
- data/levels/rebase/.githug/ORIG_HEAD +1 -0
- data/levels/rebase/.githug/config +7 -0
- data/levels/rebase/.githug/index +0 -0
- data/levels/rebase/.githug/logs/HEAD +13 -0
- data/levels/rebase/.githug/logs/refs/heads/feature +4 -0
- data/levels/rebase/.githug/logs/refs/heads/master +2 -0
- data/levels/rebase/.githug/objects/0c/d212c5b28da2e65ed4900712dd36c8adce48ad +0 -0
- data/levels/rebase/.githug/objects/44/19b972c0cd1b346ac90332aa7c5cc949589f78 +0 -0
- data/levels/rebase/.githug/objects/54/3b9bebdc6bd5c4b22136034a95dd097a57d3dd +0 -0
- data/levels/rebase/.githug/objects/81/78c76d627cade75005b40711b92f4177bc6cfc +0 -0
- data/levels/rebase/.githug/objects/98/205e9faf10cf33d2ef7c0f66e402540c62613a +2 -0
- data/levels/rebase/.githug/objects/a7/8bcab6232e9382a86436cdfcb2ed0391b1f0ac +4 -0
- data/levels/rebase/.githug/objects/b7/7313d7be366609dd2e77aa96d7fd73f4e27853 +0 -0
- data/levels/rebase/.githug/objects/b9/2d5d55d379cfb90b750e6472fc983f32ad9a71 +0 -0
- data/levels/rebase/.githug/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 +0 -0
- data/levels/rebase/.githug/objects/ed/0fdcf366b21b8984fb37ea34106978a2e5c5ba +0 -0
- data/levels/rebase/.githug/refs/heads/feature +1 -0
- data/levels/rebase/.githug/refs/heads/master +1 -0
- data/levels/rebase/README +1 -0
- data/levels/rebase.rb +16 -0
- data/levels/rebase_conflict.rb +55 -0
- data/levels/rebase_onto.rb +45 -0
- data/levels/remote.rb +16 -0
- data/levels/remote_add.rb +16 -0
- data/levels/remote_url.rb +17 -0
- data/levels/rename.rb +18 -0
- data/levels/rename_commit.rb +25 -0
- data/levels/reorder.rb +30 -0
- data/levels/repack.rb +19 -0
- data/levels/reset.rb +22 -0
- data/levels/reset_soft.rb +22 -0
- data/levels/restore.rb +28 -0
- data/levels/restructure.rb +40 -0
- data/levels/revert.rb +30 -0
- data/levels/rm.rb +20 -0
- data/levels/rm_cached.rb +18 -0
- data/levels/squash.rb +29 -0
- data/levels/stage_lines.rb +29 -0
- data/levels/stash/.githug/COMMIT_EDITMSG +1 -0
- data/levels/stash/.githug/HEAD +1 -0
- data/levels/stash/.githug/config +7 -0
- data/levels/stash/.githug/description +1 -0
- data/levels/stash/.githug/hooks/applypatch-msg.sample +15 -0
- data/levels/stash/.githug/hooks/commit-msg.sample +24 -0
- data/levels/stash/.githug/hooks/post-update.sample +8 -0
- data/levels/stash/.githug/hooks/pre-applypatch.sample +14 -0
- data/levels/stash/.githug/hooks/pre-commit.sample +50 -0
- data/levels/stash/.githug/hooks/pre-rebase.sample +169 -0
- data/levels/stash/.githug/hooks/prepare-commit-msg.sample +36 -0
- data/levels/stash/.githug/hooks/update.sample +128 -0
- data/levels/stash/.githug/index +0 -0
- data/levels/stash/.githug/info/exclude +6 -0
- data/levels/stash/.githug/logs/HEAD +1 -0
- data/levels/stash/.githug/logs/refs/heads/master +1 -0
- data/levels/stash/.githug/objects/02/060592b31c9e12ffe1b282addf9537c5ef8e1f +0 -0
- data/levels/stash/.githug/objects/4b/825dc642cb6eb9a060e54bf8d69288fbee4904 +0 -0
- data/levels/stash/.githug/objects/7f/82d7e4fba66980af16da540e18d8955518cdc2 +0 -0
- data/levels/stash/.githug/objects/85/e560abcd7e3255dcd91982476e432f4d3d1b51 +0 -0
- data/levels/stash/.githug/refs/heads/master +1 -0
- data/levels/stash/lyrics.txt +13 -0
- data/levels/stash.rb +17 -0
- data/levels/status.rb +26 -0
- data/levels/submodule.rb +20 -0
- data/levels/tag.rb +18 -0
- data/levels/unstash/.githug/COMMIT_EDITMSG +1 -0
- data/levels/unstash/.githug/HEAD +1 -0
- data/levels/unstash/.githug/config +7 -0
- data/levels/unstash/.githug/description +1 -0
- data/levels/unstash/.githug/hooks/applypatch-msg.sample +15 -0
- data/levels/unstash/.githug/hooks/commit-msg.sample +24 -0
- data/levels/unstash/.githug/hooks/post-update.sample +8 -0
- data/levels/unstash/.githug/hooks/pre-applypatch.sample +14 -0
- data/levels/unstash/.githug/hooks/pre-commit.sample +50 -0
- data/levels/unstash/.githug/hooks/pre-rebase.sample +169 -0
- data/levels/unstash/.githug/hooks/prepare-commit-msg.sample +36 -0
- data/levels/unstash/.githug/hooks/update.sample +128 -0
- data/levels/unstash/.githug/index +0 -0
- data/levels/unstash/.githug/info/exclude +6 -0
- data/levels/unstash/.githug/logs/HEAD +1 -0
- data/levels/unstash/.githug/logs/refs/heads/master +1 -0
- data/levels/unstash/.githug/objects/02/060592b31c9e12ffe1b282addf9537c5ef8e1f +0 -0
- data/levels/unstash/.githug/objects/4b/825dc642cb6eb9a060e54bf8d69288fbee4904 +0 -0
- data/levels/unstash/.githug/objects/7f/82d7e4fba66980af16da540e18d8955518cdc2 +0 -0
- data/levels/unstash/.githug/objects/85/e560abcd7e3255dcd91982476e432f4d3d1b51 +0 -0
- data/levels/unstash/.githug/refs/heads/master +1 -0
- data/levels/unstash/lyrics.txt +13 -0
- data/levels/unstash.rb +22 -0
- data/lib/githug/cli.rb +121 -0
- data/lib/githug/extensions/grit/ruby1.9.rb +21 -0
- data/lib/githug/game.rb +57 -0
- data/lib/githug/level.rb +135 -0
- data/lib/githug/profile.rb +80 -0
- data/lib/githug/repository.rb +48 -0
- data/lib/githug/ui.rb +59 -0
- data/lib/githug/version.rb +3 -0
- data/lib/githug.rb +16 -0
- data/mygithug.gemspec +27 -0
- data/spec/githug/cli_spec.rb +133 -0
- data/spec/githug/game_spec.rb +96 -0
- data/spec/githug/level_spec.rb +159 -0
- data/spec/githug/profile_spec.rb +89 -0
- data/spec/githug/repository_spec.rb +97 -0
- data/spec/githug/ui_spec.rb +112 -0
- data/spec/githug_spec.rb +316 -0
- data/spec/spec_helper.rb +1 -0
- data/spec/support/files/test_level.rb +16 -0
- metadata +549 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 32574daa79b1735c0ec65e5a4da4b71478d3cf1d
|
4
|
+
data.tar.gz: ab6e228f06875d4452ec1997c9c42801cd8a5ea4
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 03f4f5b7917319290bcf26a9c6c84aee564ddb55d709dd7261abf674be1dd0d8907fc4f91be94b2441924ef4b0975141e045a82e9237e99252ba6060e94c4af0
|
7
|
+
data.tar.gz: 2e827d31bb8ddf6bd564dd3331e04a2a9af82bd7f019b97b40072ee9fd0f62b8ed90b42e7da393e774cab51865d4e84289019c84618f54bd975897c13de7a3dc
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
language: ruby
|
2
|
+
|
3
|
+
rvm:
|
4
|
+
- 1.8.7
|
5
|
+
- 1.9.2
|
6
|
+
- 1.9.3
|
7
|
+
- 2.0.0
|
8
|
+
- 2.1
|
9
|
+
- ruby-head
|
10
|
+
|
11
|
+
matrix:
|
12
|
+
allow_failures:
|
13
|
+
- rvm: ruby-head
|
14
|
+
|
15
|
+
before_install:
|
16
|
+
- gem update --system 2.1.11
|
17
|
+
- git config --global user.email 'user@example.com'
|
18
|
+
- git config --global user.name 'Test User'
|
data/Gemfile
ADDED
data/LICENCE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Gary 'Gazler' Rennie
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
# MyGithug
|
2
|
+
玩游戏一样练习Git操作。
|
3
|
+
|
4
|
+
[![Build Status](https://travis-ci.org/meixuesong/githug?branch=master)](https://travis-ci.org/meixuesong/githug)
|
5
|
+
|
6
|
+
## About
|
7
|
+
|
8
|
+
MyGithub是基于 [Githug](https://github.com/Gazler/githug) 修改的一个练习Git的项目。
|
9
|
+
旨在为您提供学习git的实用方法。 它有一系列级别,每个级别都要求您使用git命令来获得正确的答案。
|
10
|
+
|
11
|
+
## Playing Githug
|
12
|
+
|
13
|
+
MyGithug支持Linux, OS X and Windows.
|
14
|
+
|
15
|
+
### 前提条件
|
16
|
+
|
17
|
+
你需要 Ruby 1.8.7 或更高版本. 你可以通过以下命令获取当前的Ruby版本:
|
18
|
+
|
19
|
+
```
|
20
|
+
ruby --version
|
21
|
+
```
|
22
|
+
|
23
|
+
如果你还没有安装Ruby,请按照官方文档安装:[ruby-lang.org](https://www.ruby-lang.org/en/documentation/installation/).
|
24
|
+
|
25
|
+
### 安装
|
26
|
+
|
27
|
+
要安装Mygithug,只需要运行:
|
28
|
+
|
29
|
+
gem install mygithug
|
30
|
+
|
31
|
+
如果没有权限,你可能需要以管理员身份运行。或者在Linux/Mac下 `sudo`:
|
32
|
+
|
33
|
+
sudo gem install githug
|
34
|
+
|
35
|
+
### 开始游戏
|
36
|
+
|
37
|
+
建议你为此游戏创建一个新的文件夹,然后在该文件夹下运行命令:
|
38
|
+
|
39
|
+
githug
|
40
|
+
|
41
|
+
按照提示,系统会创建一个git_hug文件夹。
|
42
|
+
|
43
|
+
No githug directory found, do you wish to create one? [yn]
|
44
|
+
|
45
|
+
Type `y` (yes) to continue, `n` (no) to cancel and quit Githug.
|
46
|
+
|
47
|
+
### 命令
|
48
|
+
|
49
|
+
游戏有4个命令:
|
50
|
+
|
51
|
+
* play - 默认命令,检查你是否已经完成当前级别的任务。
|
52
|
+
* hint - 提示信息,在你不知道如何完成任务时,你可能需要它。
|
53
|
+
* reset - 重置命令,将当前任务恢复到初始状态。
|
54
|
+
* levels - 列出所有的游戏级别。
|
55
|
+
|
data/Rakefile
ADDED
data/bin/mygithug
ADDED
data/levels/add.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
difficulty 1
|
2
|
+
description "你已经创建了文件 README, 请把它加到Stage区.
|
3
|
+
Note: You start each level with a new repo. Don't look for files from the previous one."
|
4
|
+
|
5
|
+
setup do
|
6
|
+
repo.init
|
7
|
+
FileUtils.touch("README")
|
8
|
+
FileUtils.touch("file2.txt")
|
9
|
+
|
10
|
+
`echo "Hello" >> README`
|
11
|
+
`git add file2.txt && echo "NEWlINE" >> file2.txt`
|
12
|
+
|
13
|
+
end
|
14
|
+
|
15
|
+
solution do
|
16
|
+
return false unless repo.status.files.keys.include?("README")
|
17
|
+
return false if repo.status.files["README"].untracked
|
18
|
+
return false if "1" == request("在工作区(Workspace)与Stage之间,file2.txt有哪些变化:
|
19
|
+
1. 无变化
|
20
|
+
2. 增加了一行:NEWLINE
|
21
|
+
")
|
22
|
+
"2" == request("在HEAD与Stage之间,file2.txt有哪些变化:
|
23
|
+
1. 无变化
|
24
|
+
2. 新增了文件file2.txt
|
25
|
+
")
|
26
|
+
end
|
27
|
+
|
28
|
+
hint do
|
29
|
+
puts "You can type `git` in your shell to get a list of available git commands."
|
30
|
+
end
|
data/levels/alias_lg.rb
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
difficulty 1
|
2
|
+
description "使⽤git lg来查看带有树形结构的提交记录."
|
3
|
+
|
4
|
+
setup do
|
5
|
+
repo.init
|
6
|
+
|
7
|
+
FileUtils.touch "file1"
|
8
|
+
repo.add "file1"
|
9
|
+
repo.commit_all "committed changes on master"
|
10
|
+
|
11
|
+
# add another file.
|
12
|
+
FileUtils.touch "file2"
|
13
|
+
repo.add "file2"
|
14
|
+
repo.commit_all "add another file: file2"
|
15
|
+
|
16
|
+
`git checkout -b other_branch --quiet`
|
17
|
+
# add another file
|
18
|
+
FileUtils.touch "file3"
|
19
|
+
repo.add "file3"
|
20
|
+
# `echo "hello" >> file2`
|
21
|
+
# repo.add "file2"
|
22
|
+
repo.commit_all "add another file: file3"
|
23
|
+
|
24
|
+
# `git checkout -b test_branch --quiet`
|
25
|
+
|
26
|
+
# FileUtils.touch "file4"
|
27
|
+
# repo.add "file4"
|
28
|
+
# repo.commit_all "committed change on test_branch"
|
29
|
+
|
30
|
+
`git checkout master`
|
31
|
+
|
32
|
+
FileUtils.touch "file5"
|
33
|
+
repo.add "file5"
|
34
|
+
repo.commit_all "add another file: file5"
|
35
|
+
|
36
|
+
`git merge other_branch -m "merge other_branch"`
|
37
|
+
# `git merge test_branch`
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
solution do
|
42
|
+
valid = false
|
43
|
+
|
44
|
+
config_alias_lg = repo.config["alias.lg"]
|
45
|
+
|
46
|
+
if "log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(white)%ad%C(reset) %C(bold green)%s%C(reset) %C(auto)- %an%C(reset)%C(auto)%d%C(reset)' --date=format:'%Y-%m-%d %H:%M:%S'" == config_alias_lg
|
47
|
+
valid = true
|
48
|
+
end
|
49
|
+
|
50
|
+
valid
|
51
|
+
end
|
52
|
+
|
53
|
+
hint do
|
54
|
+
puts "增加一个git别名,内容如下:log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(white)%ad%C(reset) %C(bold green)%s%C(reset) %C(auto)- %an%C(reset)%C(auto)%d%C(reset)' --date=format:'%Y-%m-%d %H:%M:%S'"
|
55
|
+
end
|
data/levels/alias_st.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
difficulty 1
|
2
|
+
description "使⽤短别名git st来查看git状态"
|
3
|
+
|
4
|
+
setup do
|
5
|
+
repo.init
|
6
|
+
end
|
7
|
+
|
8
|
+
solution do
|
9
|
+
valid = false
|
10
|
+
|
11
|
+
config_alias_status = repo.config["alias.st"]
|
12
|
+
|
13
|
+
if "status" == config_alias_status
|
14
|
+
valid = true
|
15
|
+
end
|
16
|
+
|
17
|
+
valid
|
18
|
+
end
|
19
|
+
|
20
|
+
hint do
|
21
|
+
puts "These settings are config settings. You should run `git help config` if you are stuck."
|
22
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
Another Commit
|
@@ -0,0 +1 @@
|
|
1
|
+
ref: refs/heads/master
|
@@ -0,0 +1 @@
|
|
1
|
+
f351ca63a759f56bb26924fd566294eb23455c71
|
@@ -0,0 +1 @@
|
|
1
|
+
Unnamed repository; edit this file 'description' to name the repository.
|
@@ -0,0 +1,3 @@
|
|
1
|
+
1 1
|
2
|
+
f351ca63a759f56bb26924fd566294eb23455c71 f608824888b83bbedc1f658be7496ffea467a8fb {7f8406e742c5281ec2c9bc3c6cc69dc6ba5311fd 36da01fb0571360b0e1170f0cb46e74f72927cda c1b80f5ed4995cda8e19027f0776351af6b76703 4145057e11ab90109c95882b1f40d560da408bfa 94e162b505bc2290fb67764357a625192f8a4e8a bfb16eec1081387b586dc8009ef422cfff60b622 c0a1cdff8dd63948a5fc41f5871681c5b133c053 e8dd08d5aabb62b56c80320672cd8d42e2b8954d 89d27c5f4680cd21028947be75c33a68511decb9 98d617d3bdf0b6c59d6177233acb4b9fd54b7aac 0b194f30d6867522d1666590087e6c0b5e20dc93 d406b1b8bc269c9aef9127299e83947220e7a9b0 f608824888b83bbedc1f658be7496ffea467a8fb}
|
3
|
+
1
|
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
#
|
3
|
+
# An example hook script to check the commit log message taken by
|
4
|
+
# applypatch from an e-mail message.
|
5
|
+
#
|
6
|
+
# The hook should exit with non-zero status after issuing an
|
7
|
+
# appropriate message if it wants to stop the commit. The hook is
|
8
|
+
# allowed to edit the commit message file.
|
9
|
+
#
|
10
|
+
# To enable this hook, rename this file to "applypatch-msg".
|
11
|
+
|
12
|
+
. git-sh-setup
|
13
|
+
test -x "$GIT_DIR/hooks/commit-msg" &&
|
14
|
+
exec "$GIT_DIR/hooks/commit-msg" ${1+"$@"}
|
15
|
+
:
|
@@ -0,0 +1,24 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
#
|
3
|
+
# An example hook script to check the commit log message.
|
4
|
+
# Called by "git commit" with one argument, the name of the file
|
5
|
+
# that has the commit message. The hook should exit with non-zero
|
6
|
+
# status after issuing an appropriate message if it wants to stop the
|
7
|
+
# commit. The hook is allowed to edit the commit message file.
|
8
|
+
#
|
9
|
+
# To enable this hook, rename this file to "commit-msg".
|
10
|
+
|
11
|
+
# Uncomment the below to add a Signed-off-by line to the message.
|
12
|
+
# Doing this in a hook is a bad idea in general, but the prepare-commit-msg
|
13
|
+
# hook is more suited to it.
|
14
|
+
#
|
15
|
+
# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
|
16
|
+
# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"
|
17
|
+
|
18
|
+
# This example catches duplicate Signed-off-by lines.
|
19
|
+
|
20
|
+
test "" = "$(grep '^Signed-off-by: ' "$1" |
|
21
|
+
sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || {
|
22
|
+
echo >&2 Duplicate Signed-off-by lines.
|
23
|
+
exit 1
|
24
|
+
}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
#
|
3
|
+
# An example hook script for the "post-receive" event.
|
4
|
+
#
|
5
|
+
# The "post-receive" script is run after receive-pack has accepted a pack
|
6
|
+
# and the repository has been updated. It is passed arguments in through
|
7
|
+
# stdin in the form
|
8
|
+
# <oldrev> <newrev> <refname>
|
9
|
+
# For example:
|
10
|
+
# aa453216d1b3e49e7f6f98441fa56946ddcd6a20 68f7abf4e6f922807889f52bc043ecd31b79f814 refs/heads/master
|
11
|
+
#
|
12
|
+
# see contrib/hooks/ for a sample, or uncomment the next line and
|
13
|
+
# rename the file to "post-receive".
|
14
|
+
|
15
|
+
#. /usr/share/doc/git-core/contrib/hooks/post-receive-email
|
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
#
|
3
|
+
# An example hook script to verify what is about to be committed
|
4
|
+
# by applypatch from an e-mail message.
|
5
|
+
#
|
6
|
+
# The hook should exit with non-zero status after issuing an
|
7
|
+
# appropriate message if it wants to stop the commit.
|
8
|
+
#
|
9
|
+
# To enable this hook, rename this file to "pre-applypatch".
|
10
|
+
|
11
|
+
. git-sh-setup
|
12
|
+
test -x "$GIT_DIR/hooks/pre-commit" &&
|
13
|
+
exec "$GIT_DIR/hooks/pre-commit" ${1+"$@"}
|
14
|
+
:
|
@@ -0,0 +1,46 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
#
|
3
|
+
# An example hook script to verify what is about to be committed.
|
4
|
+
# Called by "git commit" with no arguments. The hook should
|
5
|
+
# exit with non-zero status after issuing an appropriate message if
|
6
|
+
# it wants to stop the commit.
|
7
|
+
#
|
8
|
+
# To enable this hook, rename this file to "pre-commit".
|
9
|
+
|
10
|
+
if git rev-parse --verify HEAD >/dev/null 2>&1
|
11
|
+
then
|
12
|
+
against=HEAD
|
13
|
+
else
|
14
|
+
# Initial commit: diff against an empty tree object
|
15
|
+
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
|
16
|
+
fi
|
17
|
+
|
18
|
+
# If you want to allow non-ascii filenames set this variable to true.
|
19
|
+
allownonascii=$(git config hooks.allownonascii)
|
20
|
+
|
21
|
+
# Cross platform projects tend to avoid non-ascii filenames; prevent
|
22
|
+
# them from being added to the repository. We exploit the fact that the
|
23
|
+
# printable range starts at the space character and ends with tilde.
|
24
|
+
if [ "$allownonascii" != "true" ] &&
|
25
|
+
# Note that the use of brackets around a tr range is ok here, (it's
|
26
|
+
# even required, for portability to Solaris 10's /usr/bin/tr), since
|
27
|
+
# the square bracket bytes happen to fall in the designated range.
|
28
|
+
test "$(git diff --cached --name-only --diff-filter=A -z $against |
|
29
|
+
LC_ALL=C tr -d '[ -~]\0')"
|
30
|
+
then
|
31
|
+
echo "Error: Attempt to add a non-ascii file name."
|
32
|
+
echo
|
33
|
+
echo "This can cause problems if you want to work"
|
34
|
+
echo "with people on other platforms."
|
35
|
+
echo
|
36
|
+
echo "To be portable it is advisable to rename the file ..."
|
37
|
+
echo
|
38
|
+
echo "If you know what you are doing you can disable this"
|
39
|
+
echo "check using:"
|
40
|
+
echo
|
41
|
+
echo " git config hooks.allownonascii true"
|
42
|
+
echo
|
43
|
+
exit 1
|
44
|
+
fi
|
45
|
+
|
46
|
+
exec git diff-index --check --cached $against --
|
@@ -0,0 +1,172 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
#
|
3
|
+
# Copyright (c) 2006, 2008 Junio C Hamano
|
4
|
+
#
|
5
|
+
# The "pre-rebase" hook is run just before "git rebase" starts doing
|
6
|
+
# its job, and can prevent the command from running by exiting with
|
7
|
+
# non-zero status.
|
8
|
+
#
|
9
|
+
# The hook is called with the following parameters:
|
10
|
+
#
|
11
|
+
# $1 -- the upstream the series was forked from.
|
12
|
+
# $2 -- the branch being rebased (or empty when rebasing the current branch).
|
13
|
+
#
|
14
|
+
# This sample shows how to prevent topic branches that are already
|
15
|
+
# merged to 'next' branch from getting rebased, because allowing it
|
16
|
+
# would result in rebasing already published history.
|
17
|
+
|
18
|
+
publish=next
|
19
|
+
basebranch="$1"
|
20
|
+
if test "$#" = 2
|
21
|
+
then
|
22
|
+
topic="refs/heads/$2"
|
23
|
+
else
|
24
|
+
topic=`git symbolic-ref HEAD` ||
|
25
|
+
exit 0 ;# we do not interrupt rebasing detached HEAD
|
26
|
+
fi
|
27
|
+
|
28
|
+
case "$topic" in
|
29
|
+
refs/heads/??/*)
|
30
|
+
;;
|
31
|
+
*)
|
32
|
+
exit 0 ;# we do not interrupt others.
|
33
|
+
;;
|
34
|
+
esac
|
35
|
+
|
36
|
+
# Now we are dealing with a topic branch being rebased
|
37
|
+
# on top of master. Is it OK to rebase it?
|
38
|
+
|
39
|
+
# Does the topic really exist?
|
40
|
+
git show-ref -q "$topic" || {
|
41
|
+
echo >&2 "No such branch $topic"
|
42
|
+
exit 1
|
43
|
+
}
|
44
|
+
|
45
|
+
# Is topic fully merged to master?
|
46
|
+
not_in_master=`git rev-list --pretty=oneline ^master "$topic"`
|
47
|
+
if test -z "$not_in_master"
|
48
|
+
then
|
49
|
+
echo >&2 "$topic is fully merged to master; better remove it."
|
50
|
+
exit 1 ;# we could allow it, but there is no point.
|
51
|
+
fi
|
52
|
+
|
53
|
+
# Is topic ever merged to next? If so you should not be rebasing it.
|
54
|
+
only_next_1=`git rev-list ^master "^$topic" ${publish} | sort`
|
55
|
+
only_next_2=`git rev-list ^master ${publish} | sort`
|
56
|
+
if test "$only_next_1" = "$only_next_2"
|
57
|
+
then
|
58
|
+
not_in_topic=`git rev-list "^$topic" master`
|
59
|
+
if test -z "$not_in_topic"
|
60
|
+
then
|
61
|
+
echo >&2 "$topic is already up-to-date with master"
|
62
|
+
exit 1 ;# we could allow it, but there is no point.
|
63
|
+
else
|
64
|
+
exit 0
|
65
|
+
fi
|
66
|
+
else
|
67
|
+
not_in_next=`git rev-list --pretty=oneline ^${publish} "$topic"`
|
68
|
+
/usr/bin/perl -e '
|
69
|
+
my $topic = $ARGV[0];
|
70
|
+
my $msg = "* $topic has commits already merged to public branch:\n";
|
71
|
+
my (%not_in_next) = map {
|
72
|
+
/^([0-9a-f]+) /;
|
73
|
+
($1 => 1);
|
74
|
+
} split(/\n/, $ARGV[1]);
|
75
|
+
for my $elem (map {
|
76
|
+
/^([0-9a-f]+) (.*)$/;
|
77
|
+
[$1 => $2];
|
78
|
+
} split(/\n/, $ARGV[2])) {
|
79
|
+
if (!exists $not_in_next{$elem->[0]}) {
|
80
|
+
if ($msg) {
|
81
|
+
print STDERR $msg;
|
82
|
+
undef $msg;
|
83
|
+
}
|
84
|
+
print STDERR " $elem->[1]\n";
|
85
|
+
}
|
86
|
+
}
|
87
|
+
' "$topic" "$not_in_next" "$not_in_master"
|
88
|
+
exit 1
|
89
|
+
fi
|
90
|
+
|
91
|
+
exit 0
|
92
|
+
|
93
|
+
<<\DOC_END
|
94
|
+
################################################################
|
95
|
+
|
96
|
+
This sample hook safeguards topic branches that have been
|
97
|
+
published from being rewound.
|
98
|
+
|
99
|
+
The workflow assumed here is:
|
100
|
+
|
101
|
+
* Once a topic branch forks from "master", "master" is never
|
102
|
+
merged into it again (either directly or indirectly).
|
103
|
+
|
104
|
+
* Once a topic branch is fully cooked and merged into "master",
|
105
|
+
it is deleted. If you need to build on top of it to correct
|
106
|
+
earlier mistakes, a new topic branch is created by forking at
|
107
|
+
the tip of the "master". This is not strictly necessary, but
|
108
|
+
it makes it easier to keep your history simple.
|
109
|
+
|
110
|
+
* Whenever you need to test or publish your changes to topic
|
111
|
+
branches, merge them into "next" branch.
|
112
|
+
|
113
|
+
The script, being an example, hardcodes the publish branch name
|
114
|
+
to be "next", but it is trivial to make it configurable via
|
115
|
+
$GIT_DIR/config mechanism.
|
116
|
+
|
117
|
+
With this workflow, you would want to know:
|
118
|
+
|
119
|
+
(1) ... if a topic branch has ever been merged to "next". Young
|
120
|
+
topic branches can have stupid mistakes you would rather
|
121
|
+
clean up before publishing, and things that have not been
|
122
|
+
merged into other branches can be easily rebased without
|
123
|
+
affecting other people. But once it is published, you would
|
124
|
+
not want to rewind it.
|
125
|
+
|
126
|
+
(2) ... if a topic branch has been fully merged to "master".
|
127
|
+
Then you can delete it. More importantly, you should not
|
128
|
+
build on top of it -- other people may already want to
|
129
|
+
change things related to the topic as patches against your
|
130
|
+
"master", so if you need further changes, it is better to
|
131
|
+
fork the topic (perhaps with the same name) afresh from the
|
132
|
+
tip of "master".
|
133
|
+
|
134
|
+
Let's look at this example:
|
135
|
+
|
136
|
+
o---o---o---o---o---o---o---o---o---o "next"
|
137
|
+
/ / / /
|
138
|
+
/ a---a---b A / /
|
139
|
+
/ / / /
|
140
|
+
/ / c---c---c---c B /
|
141
|
+
/ / / \ /
|
142
|
+
/ / / b---b C \ /
|
143
|
+
/ / / / \ /
|
144
|
+
---o---o---o---o---o---o---o---o---o---o---o "master"
|
145
|
+
|
146
|
+
|
147
|
+
A, B and C are topic branches.
|
148
|
+
|
149
|
+
* A has one fix since it was merged up to "next".
|
150
|
+
|
151
|
+
* B has finished. It has been fully merged up to "master" and "next",
|
152
|
+
and is ready to be deleted.
|
153
|
+
|
154
|
+
* C has not merged to "next" at all.
|
155
|
+
|
156
|
+
We would want to allow C to be rebased, refuse A, and encourage
|
157
|
+
B to be deleted.
|
158
|
+
|
159
|
+
To compute (1):
|
160
|
+
|
161
|
+
git rev-list ^master ^topic next
|
162
|
+
git rev-list ^master next
|
163
|
+
|
164
|
+
if these match, topic has not merged in next at all.
|
165
|
+
|
166
|
+
To compute (2):
|
167
|
+
|
168
|
+
git rev-list master..topic
|
169
|
+
|
170
|
+
if this is empty, it is fully merged to "master".
|
171
|
+
|
172
|
+
DOC_END
|
@@ -0,0 +1,36 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
#
|
3
|
+
# An example hook script to prepare the commit log message.
|
4
|
+
# Called by "git commit" with the name of the file that has the
|
5
|
+
# commit message, followed by the description of the commit
|
6
|
+
# message's source. The hook's purpose is to edit the commit
|
7
|
+
# message file. If the hook fails with a non-zero status,
|
8
|
+
# the commit is aborted.
|
9
|
+
#
|
10
|
+
# To enable this hook, rename this file to "prepare-commit-msg".
|
11
|
+
|
12
|
+
# This hook includes three examples. The first comments out the
|
13
|
+
# "Conflicts:" part of a merge commit.
|
14
|
+
#
|
15
|
+
# The second includes the output of "git diff --name-status -r"
|
16
|
+
# into the message, just before the "git status" output. It is
|
17
|
+
# commented because it doesn't cope with --amend or with squashed
|
18
|
+
# commits.
|
19
|
+
#
|
20
|
+
# The third example adds a Signed-off-by line to the message, that can
|
21
|
+
# still be edited. This is rarely a good idea.
|
22
|
+
|
23
|
+
case "$2,$3" in
|
24
|
+
merge,)
|
25
|
+
/usr/bin/perl -i.bak -ne 's/^/# /, s/^# #/#/ if /^Conflicts/ .. /#/; print' "$1" ;;
|
26
|
+
|
27
|
+
# ,|template,)
|
28
|
+
# /usr/bin/perl -i.bak -pe '
|
29
|
+
# print "\n" . `git diff --cached --name-status -r`
|
30
|
+
# if /^#/ && $first++ == 0' "$1" ;;
|
31
|
+
|
32
|
+
*) ;;
|
33
|
+
esac
|
34
|
+
|
35
|
+
# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
|
36
|
+
# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"
|