News for hackers. Stuff that matters.
Re: by goku12 on Saturday August 05, 2023 @08:36AM (#37011405)
> Whereas, a git beginner may be more likely to start using git with a GUI, e.g. the git panel in VSCode, or something like GitKraken.

How true is this? I believed that people learned git using the CLI.

I learned git from the official book - pro-git. It's entirely based on the CLI. I've trained many to use git - again with CLI. Magit is fun to use - primarily because its UI is directly based on the CLI paradigms. Magit is often just a shortcut for the git CLI (using transient menus).

I was never really able to settle on a GUI, other than for inspecting the commit graph/DAG. The only VC tool I learned with a GUI was subversion, using TortoiseSVN. But the limitations of that GUI was very apparent and had to drop it soon afterwards.

Re: by jemmyw on Saturday August 05, 2023 @09:16AM (#37011714)
I learned and mainly use the cli but I would say it's true that most devs I've spoken to do not. Whenever the topic comes up I feel like I'm the minority suggesting the cli as a good way to use git.

The problem is if you mainly use a UI and get into a bad state then the UI tends to make it worse and you have a bad mental model so you're left asking for help and finding it hard to describe what you need. That's my experience anyway, I see that happen about once a month among my peers.

Re: by magicalhippo on Saturday August 05, 2023 @09:48AM (#37011988)
> I feel like I'm the minority suggesting the cli as a good way to use git.

I used Mercurial a lot before trying Git for the first time, the projects then switched to Git.

With Mercurial I felt right at home with the command line. Everything was simple and made sense, and I seldom had to consult the documentation after a short time learning it. I never felt the need for a GUI, or that it would improve things.

With Git it was the complete opposite. Nothing made sense at the command line. I had to do web searches for just about everything I did, either to figure out what arcane set of switches to use or to make sure I didn't fuck things up. After a short while I gave up and found a GUI, which made Git much, much better to use.

Perhaps things have improved somewhat, I hear they've cleaned up the command line options a bit. But looking at the manual[1] its clearly still far from Mercurial-level of usability[2].

[1]: https://git-scm.com/docs/git-reset#Documentation/git-reset.t...

[2]: https://book.mercurial-scm.org/read/undo.html#rolling-back-a...

Re: by Espressosaurus on Saturday August 05, 2023 @10:31AM (#37012363)
Things aren't any better. I've given up on the Git command line. I'm never going to remember the various flags-vs-unintuitively-named commands.

TortoiseGit is ugly and sucks, but the only time I've had to drop to the command line is when I need to look for the intersection or disjoint commits

Re: by Tempest1981 on Saturday August 05, 2023 @10:46AM (#37012520)
Let's not trash TortoiseGit. Sven has put so much work and polish into it. Ugly? Maybe you just hate Win32 UIs? That's ok.

TortoiseGit has many great features, including ways to compare anything you can think of.

Re: by Espressosaurus on Saturday August 05, 2023 @09:20PM (#37018012)
So far it's been the best free Git client I've used, but I miss TortoiseHg's interface.

I'm still not over Mercurial losing the DVCS wars.

Re: by goku12 on Saturday August 05, 2023 @01:22PM (#37014286)
Git has a reputation for having one of the most confusing CLIs ever. However, it's probably better to decide what operations you want to do and work from there to find out the commands needed. That obviates the need to learn so many commands and switches - for me, at least. My training material was also designed like that. My students use them like cheat-sheets until they get familiar enough.
Re: by magicalhippo on Saturday August 05, 2023 @01:50PM (#37014646)
The thing is, I want to design and write code. I don't want to remember a bunch of command line parameters for other stuff.

With Mercurial I didn't have to, it just flowed.

Re: by Espressosaurus on Saturday August 05, 2023 @09:19PM (#37018001)
I know the operation I want to perform. I even know approximately what it's called. I can't be bothered to remember what obtuse syntax is required to invoke it.

Rebasing isn't difficult, merging isn't difficult. Staging is stupid so I ignore it. The stash is stupid, so I ignore it (why not just make a new branch and commit?). Bisecting isn't difficult.

Seriously, the concepts are not rocket science. Git just makes it hard to remember how to correctly invoke the thing you want to do for no good reason other than that it was hacked together in a fit of pique and those decisions have stayed with us ever since.

And a lot of the functionality is centered around an email-based workflow, which makes sense for the Linux kernel, and doesn't make sense for anybody else.

Re: by jemmyw on Saturday August 05, 2023 @07:40PM (#37017356)
While I agree that Mercurial has done a better job with the cli and docs for making things simple, you've linked to the reference of git-reset instead of the equivalent doc for undoing things [1] which is much simpler and covers similar cases. One thing I note is that in the doc you linked switches that are default behaviour are typed out. If I look at my shell history the git commands I'm actually typing look closer to the Mercurial doc than the git doc.

[1]: https://git-scm.com/book/en/v2/Git-Basics-Undoing-Things

Re: by goku12 on Saturday August 05, 2023 @10:21AM (#37012274)
> I'm the minority suggesting the cli as a good way to use git.

I'm someone who used to train newbie staff using the git CLI. As the other commenter pointed out, the CLI often doesn't feel very intuitive. However, I personally felt that it's hard to convey what's happening behind the scenes unless you're on the CLI. And in git, it's very important to know the underlying data format and operations - unlike in case of Mercurial, for example.

Re: by gettodachoppa on Saturday August 05, 2023 @09:55AM (#37012037)
Good morning I hate git

All of my co-workers use git GUIs.

I use the CLI, not out of love for it, but because git is so needlessly complex and arcane that I'm scared to use GUIs. For every other tool, I prefer to use GUIs, but they're simple enough that I don't get surprised and there's no major consequences (such as making me spend 2 hours researching a solution) if there's an issue. Not so with git. Git has an awful CLI. It's needlessly complex for 99.999% of projects.

I write in Evernote notebooks as a learning journal and also a personal knowledge base (howto guides, troubleshooting guide, snippets, etc). Every note is written for a good reason, there's no meaningless info in it.

Here is the number of notes in my git notebook, along with a few others for comparison:

-git: 55 notes

-Linux: 200 notes

-C++: 130 notes

It's insane that git occupies so much mental space considering it's a single-purpose tool.

I truly wish it was never created, or at least never caught on, we might have another decentralized VCS dominating the space with an interface written for normal people.

If anyone other than Linus Torvalds had written it, we would all be using something else. If midwit geeks weren't so vain and wanted to feel cool for using the same VCS as the Linux kernel, we could've been using something else. (No, I can't choose to use something else, the dominant winner affects you whether you like it or not, same as IE6 and Chrome.)

Re: by goku12 on Saturday August 05, 2023 @10:16AM (#37012219)
> It's insane that git occupies so much mental space considering it's a single-purpose tool.

No arguments here. What I meant is that it's very hard for me to understand what's happening behind the scenes unless I'm using the CLI. The tool is hard nevertheless.

> If midwit geeks weren't so vain and wanted to feel cool for using the same VCS as the Linux kernel, we could've been using something else.

The fact is, git won. I was personally into mercurial. The CLI was much more sane.

One of the biggest issue with git is that it uses both the snapshot model (for the storage format) and the diff/patch model (for many operations like merge and rebase). You have to know which of these applies to any operation for it to make sense.

Re: by Hendrikto on Saturday August 05, 2023 @11:15AM (#37012822)
> One of the biggest issue with git is that it uses both the snapshot model and the diff/patch model

Git always uses snapshots. The diff thing is just a question of how this is exposed in the UI.

Re: by goku12 on Saturday August 05, 2023 @01:10PM (#37014171)
The tree state is saved as snapshots. However, operations like merging (3-way merge) and rebase are certainly based on diffs/patches.

For example, consider the case of an interactive rebase where you delete a commit. If it was based on snapshots, only that commit should disappear. The changes introduced by that commit should remain in the subsequent snapshots/commits. However, that is not what happens. The change introduced by the commit disappears from all subsequent commits/snapshots. This means that all the subsequent snapshots are modified by subtracting the patch from the commit that was deleted.

Re: by stcroixx on Saturday August 05, 2023 @10:18PM (#37018328)
Agree so much. Prior to git, I used several version control systems and none required me to memorize more than 3 or 4 simple commands. I hate git more than any other software, such a tedious waste of time.