Skip to content

Commit

Permalink
add rebase level
Browse files Browse the repository at this point in the history
  • Loading branch information
ipmsteven committed Dec 14, 2014
1 parent e454419 commit 4f53418
Show file tree
Hide file tree
Showing 24 changed files with 62 additions and 2 deletions.
16 changes: 16 additions & 0 deletions levels/rebase.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
difficulty 2

description "We are using a git rebase workflow and the feature branch is ready to go into master. Let's rebase the master branch into our feature branch."

setup do
init_from_level
end

solution do
return repo.commits('feature').last.id_abbrev != "ed0fdcf" &&
repo.commits("feature").map(&:message) == ['add feature','add content','init commit']
end

hint do
puts "You want to research the `git rebase` command"
end
1 change: 1 addition & 0 deletions levels/rebase/.githug/COMMIT_EDITMSG
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
add content
1 change: 1 addition & 0 deletions levels/rebase/.githug/HEAD
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ref: refs/heads/master
1 change: 1 addition & 0 deletions levels/rebase/.githug/ORIG_HEAD
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
4419b972c0cd1b346ac90332aa7c5cc949589f78
7 changes: 7 additions & 0 deletions levels/rebase/.githug/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = true
Binary file added levels/rebase/.githug/index
Binary file not shown.
13 changes: 13 additions & 0 deletions levels/rebase/.githug/logs/HEAD
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
0000000000000000000000000000000000000000 a78bcab6232e9382a86436cdfcb2ed0391b1f0ac ipmsteven <[email protected]> 1418373185 -0800 commit (initial): init commit
a78bcab6232e9382a86436cdfcb2ed0391b1f0ac a78bcab6232e9382a86436cdfcb2ed0391b1f0ac ipmsteven <[email protected]> 1418373194 -0800 checkout: moving from master to feature
a78bcab6232e9382a86436cdfcb2ed0391b1f0ac ed0fdcf366b21b8984fb37ea34106978a2e5c5ba ipmsteven <[email protected]> 1418373239 -0800 commit: add feature
ed0fdcf366b21b8984fb37ea34106978a2e5c5ba a78bcab6232e9382a86436cdfcb2ed0391b1f0ac ipmsteven <[email protected]> 1418373246 -0800 checkout: moving from feature to master
a78bcab6232e9382a86436cdfcb2ed0391b1f0ac 98205e9faf10cf33d2ef7c0f66e402540c62613a ipmsteven <[email protected]> 1418373270 -0800 commit: add content
98205e9faf10cf33d2ef7c0f66e402540c62613a ed0fdcf366b21b8984fb37ea34106978a2e5c5ba ipmsteven <[email protected]> 1418373282 -0800 checkout: moving from master to feature
ed0fdcf366b21b8984fb37ea34106978a2e5c5ba 98205e9faf10cf33d2ef7c0f66e402540c62613a ipmsteven <[email protected]> 1418373314 -0800 rebase: checkout master
98205e9faf10cf33d2ef7c0f66e402540c62613a 4419b972c0cd1b346ac90332aa7c5cc949589f78 ipmsteven <[email protected]> 1418373314 -0800 rebase: add feature
4419b972c0cd1b346ac90332aa7c5cc949589f78 4419b972c0cd1b346ac90332aa7c5cc949589f78 ipmsteven <[email protected]> 1418373314 -0800 rebase finished: returning to refs/heads/feature
4419b972c0cd1b346ac90332aa7c5cc949589f78 98205e9faf10cf33d2ef7c0f66e402540c62613a ipmsteven <[email protected]> 1418373423 -0800 checkout: moving from feature to master
98205e9faf10cf33d2ef7c0f66e402540c62613a 4419b972c0cd1b346ac90332aa7c5cc949589f78 ipmsteven <[email protected]> 1418373435 -0800 checkout: moving from master to feature
4419b972c0cd1b346ac90332aa7c5cc949589f78 ed0fdcf366b21b8984fb37ea34106978a2e5c5ba ipmsteven <[email protected]> 1418373492 -0800 reset: moving to ed0fdcf
ed0fdcf366b21b8984fb37ea34106978a2e5c5ba 98205e9faf10cf33d2ef7c0f66e402540c62613a ipmsteven <[email protected]> 1418373509 -0800 checkout: moving from feature to master
4 changes: 4 additions & 0 deletions levels/rebase/.githug/logs/refs/heads/feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
0000000000000000000000000000000000000000 a78bcab6232e9382a86436cdfcb2ed0391b1f0ac ipmsteven <[email protected]> 1418373194 -0800 branch: Created from HEAD
a78bcab6232e9382a86436cdfcb2ed0391b1f0ac ed0fdcf366b21b8984fb37ea34106978a2e5c5ba ipmsteven <[email protected]> 1418373239 -0800 commit: add feature
ed0fdcf366b21b8984fb37ea34106978a2e5c5ba 4419b972c0cd1b346ac90332aa7c5cc949589f78 ipmsteven <[email protected]> 1418373314 -0800 rebase finished: refs/heads/feature onto 98205e9faf10cf33d2ef7c0f66e402540c62613a
4419b972c0cd1b346ac90332aa7c5cc949589f78 ed0fdcf366b21b8984fb37ea34106978a2e5c5ba ipmsteven <[email protected]> 1418373492 -0800 reset: moving to ed0fdcf
2 changes: 2 additions & 0 deletions levels/rebase/.githug/logs/refs/heads/master
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
0000000000000000000000000000000000000000 a78bcab6232e9382a86436cdfcb2ed0391b1f0ac ipmsteven <[email protected]> 1418373185 -0800 commit (initial): init commit
a78bcab6232e9382a86436cdfcb2ed0391b1f0ac 98205e9faf10cf33d2ef7c0f66e402540c62613a ipmsteven <[email protected]> 1418373270 -0800 commit: add content
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
x��Q
!@��^�P����2:c-��Y��[�}=x�����4�s��Έ`�1 �Lbv�H�ce���a<�Zi�eh˜ ���I��(�p-� H6�j�(z�G����琷,���i������h�O�����F@ph��Dc�n��!折u��؇�}�IY
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
x��Q
!E�vo>��
mE}R��1Y��f}]�p�V�S��� FS�1GNkd�tT
i���7���`,����;�g{���\�\귢��{ �.��+�FG��8K'��픎�'.�6/#���;�
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
1 change: 1 addition & 0 deletions levels/rebase/.githug/refs/heads/feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ed0fdcf366b21b8984fb37ea34106978a2e5c5ba
1 change: 1 addition & 0 deletions levels/rebase/.githug/refs/heads/master
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
98205e9faf10cf33d2ef7c0f66e402540c62613a
1 change: 1 addition & 0 deletions levels/rebase/README
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
readme
2 changes: 1 addition & 1 deletion lib/githug/level.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Level
"commit_in_future", "reset", "reset_soft", "checkout_file", "remote",
"remote_url", "pull", "remote_add", "push", "diff", "blame", "branch",
"checkout", "checkout_tag", "checkout_tag_over_branch", "branch_at",
"delete_branch", "push_branch", "merge", "fetch", "repack", "cherry-pick",
"delete_branch", "push_branch", "merge", "fetch", "rebase", "repack", "cherry-pick",
"grep", "rename_commit", "squash", "merge_squash", "reorder", "bisect",
"stage_lines", "find_old_branch", "revert", "restore", "conflict", "contribute"]

Expand Down
8 changes: 7 additions & 1 deletion spec/githug_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def skip_level
`echo "*.swp" >> .gitignore`
`githug`.should be_solved
end

it "solves the include level" do
`echo "*.a\n!lib.a" >> .gitignore`
`githug`.should be_solved
Expand Down Expand Up @@ -231,6 +231,12 @@ def skip_level
`githug`.should be_solved
end

it "solves the rebase level" do
`git checkout feature`
`git rebase master`
`githug`.should be_solved
end

it "solves the repack level" do
`git repack -d`
`githug`.should be_solved
Expand Down

0 comments on commit 4f53418

Please sign in to comment.