Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Show HN: Effective Git (github.com/nolasoft)
37 points by nola-a 11 days ago | hide | past | favorite | 9 comments
As many of us shift from being software engineers to software managers, tracking changes the right way is growing more important.

It’s time to truly understand and master Git.

 help



I'd recommend using git switch instead of checkout, since the checkout command is so overloaded. And restore instead of checkout for restoring changes.

I know it's just my opinion, but even though 'checkout' is overloaded with meanings, I always find it the most unambiguous. Some of my coworkers keep telling me to use 'switch' instead, but every time I try it, I find myself wondering how it works

I get it but I think you're essentially saying "I learnt it this way and it's hard to change once I learnt it that way". My argument is that "when teaching others, it's better to teach them to use switch and restore rather than checkout".

Unfortunately, muscle memory cannot be changed that easily. And thanks to the git maintainers, the checkout command still exists, because apparently they know that.

After using git for about 15 years, I still find "git merge" unpleasant and hard to track changes. I've always had better experiences rebasing my branch on top of the current main and then committing the resultant changes. Of course it helps if you are regularly rebasing from main rather than leaving it until the end, but the process still usually feels cleaner than with git merge.

The only downside of rebasing (for me) is it looks confusing when commits aren't sequentially in date order, and sometimes it feels like you need to resolve the same conflict several times (once for each commit that gets rebased if they touch the same code) but that usually works out better for me than a regular merge.


If you're working on your private branch and can tolerate a small loss of accuracy in your commit history, then rebasing is fine. However, if you sometimes use reflog to recover from minor issues, it can become more difficult after you've rebased.

> This document wants to be a reference for best practices in the daily use of Git

Then it wouldn't stick to the most ineffective interface for git - cli


Eh. If you're interested in sharpening your vcs toolchain, just learn jj already

I've learnt jujutsu. It took me a couple weeks to get it but 100℅ worth it. I've always intuitively understood git but jj does make a lot of annoying things easy. My commit history is now much cleaner than ever before. It's not for everyone though. Takes a lot of upfront investment to learn when git is often already good enough.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: