benthayer / git-gud

Wanna git gud? Then get git-gud, and git gud at git!
MIT License
401 stars 42 forks source link

Level: Basics 4 - "A Half Commit" #253

Open benthayer opened 3 years ago

benthayer commented 3 years ago

A level to show that the commit isn't necessarily the same as the working directory.

Start with no commits. The working directory will have a file in it, and the file will be added to the staging area, but it will have only part of the updates. The updates can be made in the next commit.

git gud status at the beginning

Working Directory
hello.txt - "Hello world"
Staging Area
hello.txt - "Hello"

git gud status at the end

Working Directory
hello.txt - "Hello world"
Staging Area
hello.txt - "Hello world"
Commit 1:
hello.txt - "Hello"
Commit 2:
hello.txt - "Hello world"

The operating system lets us check when the file was modified, so we'll have to save that information and use it when checking to see if the level has been completed. If the user edits the file at any point, the message provided by git gud test would be something like Looks like the commits are right, but we see that you've modified the file at some point during the level. Please use "git gud reset" to start over.

sahansk2 commented 3 years ago

@benthayer Opeop

benthayer commented 3 years ago

@sahansk2 Is it worth it to implement #284 just for this level? It doesn't seem like any other levels need #284

Either way, I think it makes sense either for you to work on #284 or for me to work on this level

sahansk2 commented 3 years ago

@benthayer You can take on this level, since you're already pretty familiar with how details.yaml is implemented.

benthayer commented 3 years ago

Sounds good, updated the assignee