Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Level: The Truth #277

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Level: The Truth #277

wants to merge 5 commits into from

Conversation

benthayer
Copy link
Owner

@benthayer benthayer commented Aug 10, 2020

fixes #262

I changed the layout of the level so you have to detach HEAD, which will be the first time the user has done so. This makes the existing rampup detaching obsolete (and removed), which is fine because the explanation is weaved into this level.

Explanation is obviously incredibly long, but I'm not sure how much it can be shortened without reducing content. It might be worth splitting up the level? I think user tests (post-merge) would be the best.

Also, there are files from the easy level there, but that's how this level was started, and we don't want git to think they got removed, so that's fine.

@benthayer
Copy link
Owner Author

@sahansk2 How do you like the level?

@sahansk2
Copy link
Contributor

sahansk2 commented Aug 11, 2020

Level looks pretty good! I was just thinking that maybe we should output

Run git gud explain for more details.

at the end of the goal text when the level is loaded. I actually tried to go about this level without running git gud explain, but that might be because I'm not used to running git gud explain. :v

I'm making a proper review right now, but it's just this comment for now.

I'm guessing that this level isn't complete yet, right? Running through the level (without running git gud explain, this is what I did):

sahan@sahan-Lenovo-YOGA-C930-ubuntu:test$ git gud load 6
Just like last level, make the log messages form the sentence "This is an easy level"
This time, instead of rebasing, detach HEAD using git checkout then use git cherry-pick.
Save your changes on a new branch named whatever you want, but don't check it out.

<<<<<<< Simulating: git log --reverse --oneline
550efb4 This
591377c easy
7440f56 an
af1bdca is
c529d67 (HEAD -> master) level
=======
sahan@sahan-Lenovo-YOGA-C930-ubuntu:test$ git checkout 550e
Note: switching to '550e'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at 550efb4 This
sahan@sahan-Lenovo-YOGA-C930-ubuntu:test$ git switch -c complete
Switched to a new branch 'complete'
sahan@sahan-Lenovo-YOGA-C930-ubuntu:test$ git cherry-pick af1b
[complete c78ec41] is
 Author: Git Gud <[email protected]>
 Date: Tue Aug 11 11:49:20 2020 -0400
 1 file changed, 1 insertion(+)
 create mode 100644 2.txt
sahan@sahan-Lenovo-YOGA-C930-ubuntu:test$ git cherry-pick 7440f
[complete fe1eca7] an
 Author: Git Gud <[email protected]>
 Date: Tue Aug 11 11:49:19 2020 -0400
 1 file changed, 1 insertion(+)
 create mode 100644 3.txt
sahan@sahan-Lenovo-YOGA-C930-ubuntu:test$ git cherry-pick 7440
On branch complete
You are currently cherry-picking commit 7440f56.
  (all conflicts fixed: run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

nothing to commit, working tree clean
The previous cherry-pick is now empty, possibly due to conflict resolution.
If you wish to commit it anyway, use:

    git commit --allow-empty

Otherwise, please use 'git cherry-pick --skip'
sahan@sahan-Lenovo-YOGA-C930-ubuntu:test$ git commit --allow-empty
/usr/bin/python3: No module named gitgud.hooks.precommit

Copy link
Contributor

@sahansk2 sahansk2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good stuff -- I just pointed out some things that I think need attention.

gitgud/skills/rewriting/_truth/explanation.txt Outdated Show resolved Hide resolved
gitgud/skills/rewriting/_truth/explanation.txt Outdated Show resolved Hide resolved
gitgud/skills/rewriting/_truth/explanation.txt Outdated Show resolved Hide resolved
In comes the concept of the 'detached HEAD' state. Simply use "git checkout <commit_hash>" to modify HEAD so that it points to the commit instead of the branch.
>>>
As you've seen, a commit hash is a unique identifier for a commit.
Use "git log" or "git gud status" to see the commit tree and to look for the hashes.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should also mention git gud show tree

@benthayer
Copy link
Owner Author

Just pushed. I'm thinking that it's not worth running git gud show-tree or git gud explain because they'll already be accustomed to running git gud explain, and git gud show-tree isn't specifically useful for this level. They can just run git log and get the same information. We can always see what the users say after we merge

@benthayer
Copy link
Owner Author

@sahansk2 Can you review this again?

Copy link
Contributor

@sahansk2 sahansk2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything looks okay, but the level isn't working for me. Am I solving this wrong?

sahan@sahan-Lenovo-YOGA-C930-ubuntu:test$ git gud reset
Just like last level, make the log messages form the sentence "This is an easy level"
This time, instead of rebasing, detach HEAD using git checkout then use git cherry-pick.
Save your changes on a new branch named whatever you want, but don't check it out.

<<<<<<< Simulating: git log --reverse --oneline
8c8de00 This
e85da6a easy
b36acb6 an
3f7b140 is
fca0611 (HEAD -> master) level
=======
sahan@sahan-Lenovo-YOGA-C930-ubuntu:test$ git checkout 8c8d
Note: switching to '8c8d'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at 8c8de00 This
sahan@sahan-Lenovo-YOGA-C930-ubuntu:test$ git cherry-pick 3f7b
[detached HEAD f4b9f9d] is
 Author: Git Gud <[email protected]>
 Date: Fri Aug 14 18:06:49 2020 -0400
 1 file changed, 1 insertion(+)
 create mode 100644 is.txt
sahan@sahan-Lenovo-YOGA-C930-ubuntu:test$ git cherry-pick b36a
[detached HEAD 219197c] an
 Author: Git Gud <[email protected]>
 Date: Fri Aug 14 18:06:48 2020 -0400
 1 file changed, 1 insertion(+)
 create mode 100644 an.txt
sahan@sahan-Lenovo-YOGA-C930-ubuntu:test$ git cherry-pick e85d
[detached HEAD e9e7033] easy
 Author: Git Gud <[email protected]>
 Date: Fri Aug 14 18:06:47 2020 -0400
 1 file changed, 1 insertion(+)
 create mode 100644 easy.txt
sahan@sahan-Lenovo-YOGA-C930-ubuntu:test$ git cherry-pick fac0
fatal: bad revision 'fac0'
sahan@sahan-Lenovo-YOGA-C930-ubuntu:test$ git cherry-pick fca0
[detached HEAD 3fdca3d] level
 Author: Git Gud <[email protected]>
 Date: Fri Aug 14 18:06:50 2020 -0400
 1 file changed, 1 insertion(+)
 create mode 100644 level.txt
sahan@sahan-Lenovo-YOGA-C930-ubuntu:test$ glog
* 3fdca3d (HEAD) level
* e9e7033 easy
* 219197c an
* f4b9f9d is
* 8c8de00 This
sahan@sahan-Lenovo-YOGA-C930-ubuntu:test$ gloga
* 3fdca3d (HEAD) level
* e9e7033 easy
* 219197c an
* f4b9f9d is
| * fca0611 (master) level
| * 3f7b140 is
| * b36acb6 an
| * e85da6a easy
|/  
* 8c8de00 This
sahan@sahan-Lenovo-YOGA-C930-ubuntu:test$ git branch mysolution
sahan@sahan-Lenovo-YOGA-C930-ubuntu:test$ gloga
* 3fdca3d (HEAD, mysolution) level
* e9e7033 easy
* 219197c an
* f4b9f9d is
| * fca0611 (master) level
| * 3f7b140 is
| * b36acb6 an
| * e85da6a easy
|/  
* 8c8de00 This
sahan@sahan-Lenovo-YOGA-C930-ubuntu:test$ git gud test
Level not complete, keep trying. "git gud reset" to start from scratch.
sahan@sahan-Lenovo-YOGA-C930-ubuntu:test$ git gud goal
Just like last level, make the log messages form the sentence "This is an easy level"
This time, instead of rebasing, detach HEAD using git checkout then use git cherry-pick.
Save your changes on a new branch named whatever you want, but don't check it out.
sahan@sahan-Lenovo-YOGA-C930-ubuntu:test$ git gud status 
<<<<<<< Simulating: git log --reverse --oneline
8c8de00 This
f4b9f9d is
219197c an
e9e7033 easy
3fdca3d (HEAD, mysolution) level
=======
sahan@sahan-Lenovo-YOGA-C930-ubuntu:test$ 

@benthayer
Copy link
Owner Author

The description of the level doesn't match the testing. I don't believe we check to see if another branch is created

@benthayer benthayer changed the base branch from master to main November 26, 2020 19:11
@benthayer
Copy link
Owner Author

@sahansk2 I'm gonna throw the ball in your court here since I made updates after your comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Level: Rewriting History 7 - "The Truth"
2 participants