News for hackers. Stuff that matters.
Re:Idiot Proof Git by est on Thursday November 10, 2022 @02:31AM (#33543356)
> What do you mean by idempotent?

For every git command, provide a way to undo the previous command, if possible.

For example, `git checkout -b abc`, a `git undo` would execute `git branch -D abc`.

This is just an example, I know you can find many problems and with this approach and edge cases when it doesn't work, but we can make life easier for beginners in most cases.

> Clicking undo two times and going back only one step

Huh? I never meant that. Click undo two times would go back two steps, naturally.

But of course, there are some actions that can't undo, so give user a warning or something.

Re:Idiot Proof Git by diffeomorphism on Thursday November 10, 2022 @02:56AM (#33543525)
https://www.merriam-webster.com/dictionary/idempotent

idempotent means that doing it twice gives the same result as doing it once. So it seems you meant a different word?

Re:Idiot Proof Git by est on Thursday November 10, 2022 @05:33AM (#33544623)
Yes I mean undo would always restore the git to a previous state no matter what kind of commands you typed (best effort). It's perfectly symmetrical forward and backward operation which will guarantee restore to the same repo result whether you misstep git once or multiple times.

Is there a better word to describe this? I am an ESL speaker.

Re:Idiot Proof Git by Xelbair on Thursday November 10, 2022 @05:39AM (#33544656)
I suppose they meant that (most) git commands should be idempotent, and therefore easily reversible.
Re:Idiot Proof Git by diffeomorphism on Thursday November 10, 2022 @10:53AM (#33548249)
Being idempotent does not help much with invertibility, e.g. zeroing out a file is idempotent.

In any case, the above post makes sense if you just delete the word.