News for hackers. Stuff that matters.
Re:Idiot Proof Git by seba_dos1 on Thursday November 10, 2022 @06:09AM (#33544870)
git is already an undo mechanism itself. Commits are immutable. `git reflog` provides an undo log for pretty much every operation on the repository. `git push` shows the previous state of the branch which you can use to easily undo what you just did on the remote.

The only part that isn't easily undo-able is the index and working dir, but that's kinda the point of having an index in the first place. If you overwrite or delete a file without staging it in git, or unstage and then change it, git isn't going to magically restore it with an undo command. And that's fine.

There are no comments on this comment yet.