r/git•
LewNeaf

Git Gud is an interactive Python application/game that lets you learn Git interactively and natively in the shell, with multiple levels to learn about different aspects of Git (rebasing, cherry-picking, and more!). Check it out, come contribute, or both!

tutorial
github.com/benthayer/git-gud/
github.com

Posted Apr 12, 2021, 3:02 PM UTC

849
LewNeafOP•

Though I'm not an official contributor, I've contributed a lot to this project. Feel free to ask me questions, and I'll do my best to give meaningful answers appropriate to my experience and role.

5
[deleted]•

[deleted]

1
double•

Nice idea but the learning ramp is a bit steep.

I'm doing stuff within ~6 lessons that I've not done in >13 years of using git.

Is "reverse" a verb that other people use on commits?

2
LewNeafOP•

If you're asking if git reverse is a command, then I'll say no.

But if you're asking if people want to "reverse" the effects of commits, then yeah, that'll happen. More often than not, in the wild, I've seen "undo" used more often as the verb (e.g. "How do I undo a commit", "How do I undo the last X commits", etc.).

Regardless of the English verb used, I have most definitely reversed/undone commits I have made, whether it's to rename them, to edit the actual code changes, or to trash them completely and start anew. It's definitely more preferable than to "save your files and clone the repo again".

If you're talking about in reference to a level, I believe "Reversing Changes in Git" (load the level with git gud load rampup reversing) briefly goes over reverting (git revert) and resetting (git reset) commits.

Does that answer your question?

0
double•

Does that answer your question?

I have read your message a few times and I think my answer is "no"... but perhaps I am simply too stupid to understand it.

1
LewNeafOP•

It's more likely that I haven't explained it well. Could you elaborate on your question

Is "reverse" a verb that other people use on commits?

, and why you have this question?

1
double•

Could you elaborate on your question and why you have this question?

Gladly.

Perhaps it is better to start with your initial reply:

But if you're asking if people want to "reverse" the effects of commits, then yeah, that'll happen. More often than not, in the wild, I've seen "undo" used more often as the verb (e.g. "How do I undo a commit", "How do I undo the last X commits", etc.).

Regardless of the English verb used, I have most definitely reversed/undone commits I have made, whether it's to rename them, to edit the actual code changes, or to trash them completely and start anew. It's definitely more preferable than to "save your files and clone the repo again".

I get the sense that in one way a 'reverse' for you is a "revert", so would you consider "undo" a "revert"? So git revert <hash> would apply there. Does that mean that the semantics of git gud map "reverse" to "revert"? If so, why not just use revert?

But then you talk about editing, wouldn't that be an "amend"? So git commit --amend or perhaps a nice git filter-branch if you're doing say a batch email edit, or perhaps use bfg or some other variant if you wanted to delete those pesky big files... semantically this would be an "edit" nonetheless (?). One would expect that at lesson 6, the lesson plenary would just be to teach an amend.

Or does "reverse" mean performing an (interactive, probably) rebase where you might invert the commit order, like in a reverse sort - going into any rebase where I need to do aggressive history shuffling like that, I wish beyond wish that I will have already dealt with the conflicts such that rerer ends up doing the heavy lifting.

So, I guess my question is why use "reverse" or "undo" when there are various well established semantics when teaching new people to the discipline? If I am reading the first reply properly, then separating out lessons for teaching "reset" and "revert" would be a very good idea, especially "reset" where the subtleties of "soft" or "hard" resets are best understood once the concepts of "staged", "unstaged" and "commited" are nailed.

2
valerionew•

Thanks, i played today, had a fun time and i even managed to break it

1
LewNeafOP•

Aaaaaaaand it's fixed ;)

1