News for hackers. Stuff that matters.
Re:Git undo: We can do better by pjettter on Monday June 21, 2021 @12:48PM (#27580950)
Git should store the commands that "did" the operations on a repo. Git should never ever let you lose work. I should always be able to go "backward" and recover previous states. I guess that is what the "Git undo" proposal is about.

I'm a very visual person so I tend to use Git Graph on VSCode. But I still get in trouble. Especially things like Cherry Picking, or reverting.

Another thing that is not so easy is switching branches without having to do a commit. Stashing, yeah, but then figuring out whether stashes have been applied or not, diffing between branches, picking some changes from a diff.

In the end I stick to some basic commands that don't get me in trouble so that I don't lose half a day to recover my work via Dropbox.

Re:Git undo: We can do better by prisonality on Monday June 21, 2021 @01:16PM (#27581241)
> Git should store the commands that "did" the operations on a repo.

is `git reflog` not enough for your use case ?

Re:Git undo: We can do better by pjettter on Monday June 21, 2021 @01:23PM (#27581330)
No, I mean more like an audit trail. Not like `blame` either. What I typed on the command line to get into a new state.
Re:Git undo: We can do better by sixstringtheory on Monday June 21, 2021 @06:10PM (#27585192)
What about `history | grep “^git”?

Edit to add: the downside is that it only works in the current terminal session. To workaround that for myself, I have a fish shell post exec function that records the last command run, plus a bunch of metadata, to a log file.