this post was submitted on 17 Mar 2024
61 points (100.0% liked)

Git

2822 readers
4 users here now

Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.

Resources

Rules

  1. Follow programming.dev rules
  2. Be excellent to each other, no hostility towards users for any reason
  3. No spam of tools/companies/advertisements. It’s OK to post your own stuff part of the time, but the primary use of the community should not be self-promotion.

Git Logo by Jason Long is licensed under the Creative Commons Attribution 3.0 Unported License.

founded 1 year ago
MODERATORS
top 8 comments
sorted by: hot top controversial new old
[–] [email protected] 13 points 5 months ago* (last edited 5 months ago) (2 children)
Git bisect

Is goddamn amazing! I had a very large multi-branch project that somewhere somehow had some crashing bug. Instead of searching through 5 or so branches with 20 something large commits for each, I bisected like 7 times and it told me exactly where to bug was introduced.

Highly recommended

[–] [email protected] 8 points 5 months ago (1 children)

Highly recommended

I agree. Once we get a hang of the value that bisect brings, one unintended consequence is that we start to value atomic commits a whole lot more. There is nothing more annoying than bisecting a bug and suddenly stumbling upon a commit that does it all: updates dependencies, touches everything under the sun, does cleanup commits for unrelated files, etc. Yuck.

[–] [email protected] 2 points 5 months ago

Exactly! My case was such a case actually. But it further shows that bisect is a great tool that benefits from good practice.

[–] [email protected] 5 points 5 months ago (1 children)

I love git bisect for complex regressions! If I don't immediately know where a bug is, I write a regression test and then bisect to find where it was introduced. Knowing exactly where the bug was introduced and being able to look at the diff almost always speeds up finding the bug.

[–] [email protected] 5 points 5 months ago

For those who don't know (I assume you do), you can git bisect run some_command and git will automatically run git bisect until it finds the falty commit. It's amazing.

[–] [email protected] 9 points 5 months ago (1 children)

git worktree I was not aware of. Very interesting!

[–] [email protected] 2 points 5 months ago* (last edited 5 months ago)

It's so anoying that at $WORK we have multiple git repos with symbolic link that points above their respective .git to each other and need to be in sync. So of course git workree and git bisect don't work that well…

[–] [email protected] 1 points 5 months ago

I just took a stab at git worktree at work this week after rereading this article. It's amazing. We were in the process of upgrading our UI component library and I was able to checkout pre/post upgrade branches without having to continuously npm install to swap between dependencies.

Plus I'm pretty sure I could have both "versions" of our repo locally running at the same time so I could do UI comparisons...but I didn't actually get that far.