News for hackers. Stuff that matters.
Re:Git is too hard by 0xffff2 on Tuesday November 17, 2020 @01:12PM (#25127321)
I think I've used `reflog` maybe... twice in a decade of daily git use. It's crazy to me that anyone would think that it's a daily use command. I don't even know what bisect is off the top of my head.
Re:Git is too hard by jacoblambda on Tuesday November 17, 2020 @04:21PM (#25130010)
I don't use `reflog` often but I've found that 9/10 times you make a serious mistake in git, it ends up being the go to solution.

As for `bisect`, it's magic. It is used to binary search git commits back to X point in time. You can use it to manually go through previous commands to find what code/how long ago a bug was introduced. You can also rig it up with a test command (say a unit test that you copy out of the working tree/keep in a separate worktree) and have it automatically sift through the commits and tell you the first point where it starts to fail.

Re:Git is too hard by simiones on Tuesday November 17, 2020 @01:27PM (#25127531)
Bisect is a debugging utility - it helps you do a binary search for the commit which introduced a bug by checking out code at certain commits, having you compile and run it, and tell git if the bug was there or not, and then going back or forward in history until you can identify the 1 commit that caused the bug to appear.

I've never used it, but it sounds like a nice tool of last resort.

Re:Git is too hard by account42 on Wednesday November 18, 2020 @06:30AM (#25135612)
> it sounds like a nice tool of last resort

It is actually a great first debugging tool for regressions (unless you already have a hunch where the problem is). It's usefulness is greatly enhanced if you keep your commits small.

Re:Git is too hard by simiones on Wednesday November 18, 2020 @09:28AM (#25137098)
Usually, I prefer to investigate a bug starting from the code rather than the history, if it's possible. In my experience, most bugs have taken longer to reproduce repeatedly than to understand from code. Besides, there's no guarantee that a bisect will land at the right commit if the bug is not reliably reproducible.

But I have been in situations where I had to manually bisect the code because I just couldn't understand how the code could reproduce the problem, and having git bisect would have been a significant help.