this post was submitted on 08 Nov 2023
84 points (85.6% liked)
Programming
17373 readers
324 users here now
Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!
Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.
Hope you enjoy the instance!
Rules
Rules
- Follow the programming.dev instance rules
- Keep content related to programming in some way
- If you're posting long videos try to add in some form of tldr for those who don't want to watch videos
Wormhole
Follow the wormhole through a path of communities [email protected]
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
A much simpler solution: don't use the git CLI. And in my professional life I don't know a single person who does. The shortcomings of git have long been abstracted away and as problematic as the CLI is, it's now just an internal library of the tools we actually use.
Also the
git pull
criticism is weird. Yeah it exists on paper, and year every so often once in a blue moon there's a conflict after a pull with rebase, but... this doesn't even begin to dent the oodles of time saved from just doing Ctrl+T in IntelliJ and be up-to-date with no further input. Why waste 20 minutes 40x-100x a day instead of 45 minutes once every 3-6 months? Especially this case:I'm sorry, but are you collaborating or competing on a shared branch? If it is a collaborative effort, maybe just talk about it? And in fact, unless the other person is an utter asshole, they'll have done so before merging in the new changes from
main
. That's not even to mention that in 99,95% of cases or so, that exact scenario is perfectly fine and gets resolved without any issues whats-o-ever and no user input necessary. Bringing us once again to the situation where you save a moderate amount of time multiple times a day by always just pulling.(edit)
Don't get me wrong, all of this criticism is of course valid. But it feels like a very arcane case, as no project should be able to produce the issues frequently unless there's some underlying problem in either the mode of collaboration or the structure of the project in the first place, and the usage of git is long abstracted away and the tools handle virtually any and all edge case, including making merging far smarter than if you were to use the CLI.
I’ve used the git cli exclusively for more than a decade, professionally. I guess it varies wildly by team, but CLIs are the only unambiguous way to communicate instructions, both for humans and computers. That being said, I still don’t mess around with rebase for anything, and I do use a gui diff tool for merge conflict resolution. Practically everything you need to do with git can be done with like 10 commands (I’m actually being generous here, including reset, stash, and tag).
Rebasing has a worse reputation than it deserves. It's something you just get used to - just like how git use is, when you started using it. There are a couple of strategies to make it easier and less anxiety inducing:
After a while, rebasing becomes as simple as commit or merging.
Rebasing and merge conflicts are the top ways that git can turn into a mess. I know that rebasing could (in some circumstances) make merge conflicts less of an issue, but I just mostly think the value of "commit grooming" is overrated. I don't want to argue about this, if you like doing it, go ahead.
I had to check and make sure I didn't type the comment above because it sounds exactly like me.
All UIs do things slightly differently, the CLI is always exactly the same... Everywhere. UI for non trivial conflict resolution? Definitely. For everything else, CLI.
And, I'm also reticent to use rebase unless I have to. Gimme that good ole FF :)
I dont know about that... Never found they help that much in conflict resolution. They give you some nice buttons for accept their or accept our changes but really I find more often than not those are what breaks code as you often want a mash-up of both sides - which needs to be manually done even in UIs.
Otherwise it is just find the marked sections in the file, and make it look like what you want it to after the merge/rebase. And that is the hardest part - figuring out what it should look like. Which is made easier if you only ever have small commits and merge back to master frequently minimizing the amount your branches drift from each other.
I do, I find it much simpler than using the GUIs
I usually use a gui but I know plenty of colleagues who exclusively use cli. I've never understood if it's an ego thing or what but it's an incredibly popular way to use git
I exclusively use CLI, it's not ego at all, I simply find typing what I want to be quicker than clicking buttons. I've written a bunch of aliases to automate my common workflows.
When I need to help a colleague who's made a mess of something, I can easily give them the command to fix it rather than finding the right options in their GUI of choice and it's often because of some broken abstraction in the GUI they got into the mess in the first place.
Yeah there are totally commands I use daily, but the visualization involved in looking at the log and available branches (which is a constant use case) is much easier in a gui for me. In fact I'd go as far as saying logs, diffs, and branching in cli are neigh unusable. The buttons I click while in the gui (like fetch/pull/commit) are largely used because at that point (after finding and checking out the right branch, etc) it would be slower to switch back to cli.
I only mentioned ego because I've seen multiple junior devs struggling with the command line resist using a gui even when it solves a specific problem they are having quite easily. To each their own though.
I use the CLI for simple commands, especially if helping someone on another PC and I don't have access to my preferred tool, but I honestly don't get people who use it religiously and never even try tools with GUIs. The convenience of being able to easily see the commit history, scroll through it, have a right click context menu or ability to just click it and see file changes (and then right click those files for additional options), is just something I can't abandon. Nowadays even the aliasing can be replicated in those tools if they support creation of custom commands so even that is a moot point - with some setup you can be as fast as with a CLI.
Exactly my same thoughts!
Meh I find I can do 95% of what I need through the cli just fine. Diff-ing can be annoying if you just want to skim through a commit but otherwise I don't see what I miss by using the cli
I do have a huge ego, but I'll claim it's a total coincidence that I use CLI git.
My main reason to use mostly CLI is the better error messages I get when something goes wrong.
My secondary reason is that my preferred GUI tools for git didn't used to have support for operations I do often such as 'cherry-pick' and 'rebase'. I think that is mostly solved now, but my habits change slow and I'm used to the CLI.
Haha fair. My experience though, is that cherry picking is easily done in gui and I've honestly never attempted on cli because it only takes me three clicks in Fork
Yeah. Cherry pick was the killer feature for CLI back when I was forming habits. Seems like it's built into most tools now, which is really nice.
There are things that my GUI of choice lack, so I occasionally type out a command, although I did also bind a couple of commands to GUI buttons, so there's that.
Which to me is just wild unless you're doing something you wouldn't want to use an IDE for - and that's not actually that many professional things, if I'm being honest. But if you use an IDE, then it's far easier, faster and importantly doesn't take you out of your mental flow to just use the built-in git abstraction of that IDE.
O that's my pet peeve, I hate integrated git GUI's in IDE's. The only useful thing is file and code highlight for changes, other than that I disable that stuff as fast as possible.
I mostly agree. The caveat to this is I've had to learn CLI for programmatic use cases like automation.