• _____@lemm.ee
    link
    fedilink
    English
    arrow-up
    130
    arrow-down
    2
    ·
    1 month ago

    let’s turn this into a constructive angle for future devs and current juniors: just learn git cli, I promise you it is much simpler than it seems.

    all those memes about git having like a thousand commands are true, but you really will only use like 7 at most per month.

    learn push, pull, merge, squash, stash, reset, im probably missing like one or two

    I promise you again: it is much simpler than it seems. and you won’t have to use these stupid git GUI things, and it will save you a hassle because you will know what commands you are running and what they do

    short disclaimer: using git GUI is totally fine but low-key you are missing out on so much

    • MajorasMaskForever@lemmy.world
      link
      fedilink
      English
      arrow-up
      21
      arrow-down
      1
      ·
      1 month ago

      Every time I mentor a dev on using git they insist so much on using some GUI. Even ones who are “proficient” take way longer to do any action than I can with cli. I had one dev who came from SVN land try and convince me that TortoiseGit was the only way to go

      I died a little that day, and I never won her over to command line despite her coming to me kinda regularly to un-fuck her repository (still one of the best engineers I ever worked with and I honestly miss her… Just not her source control antics)

        • MajorasMaskForever@lemmy.world
          link
          fedilink
          English
          arrow-up
          6
          ·
          1 month ago

          That is the one use case I’ve seen where a gui is absolutely faster.

          In my line of work, I primarily work on embedded systems or process automation so any new files in the repo directory either need to be added for tracking or to the ignore file. I’m not saying it will never happen, but at least in my experience it happens so rarely that I always try to teach command line when possible

        • ulterno
          link
          fedilink
          English
          arrow-up
          2
          ·
          edit-2
          1 month ago

          Did you not know?
          You can simply select all files you want to commit, in the File Manager, Ctrl+C, then paste in the terminal and it will automatically add all those file names (full paths) separated with spaces at the cursor. At least in KDE: Dolphin -> zsh + Konsole it does.

          And sure, it might look like 2 extra steps, but you will still be clicking around a lot in case of a GUI anyway.

          I tend to just type partial filenames and use tab completions, which are also pretty configurable. And the only dissatisfaction I have rn, is that I don’t have zsh module for completions with pascal case and snake case.

      • Antiproton
        link
        fedilink
        arrow-up
        15
        arrow-down
        1
        ·
        1 month ago

        The difference in speed is familiarity, not some inherent efficiency gain by typing commands into the cli.

        • MajorHavoc
          link
          fedilink
          arrow-up
          7
          ·
          1 month ago

          You’re 100% right.

          But I defy anyone’s mouse-foo to come anywhere near the speed of my typing speed and alias list.

          Even someone mastering GUI keyboard shortcuts isn’t going to be able to match, because my terminal is optimized beyond what is possible in a more graphical app.

          What I’m trying to say is that no one can introduce a thoughtless mistake into production code as quickly as I can.

          • MajorasMaskForever@lemmy.world
            link
            fedilink
            English
            arrow-up
            4
            ·
            1 month ago

            The real metric is dollars per second of destroyed hardware ;)

            I once watched an engineer blow up a $200k prototype with a terminal alias.

            • MajorHavoc
              link
              fedilink
              arrow-up
              2
              ·
              1 month ago

              That’s impressive. I’m glad I don’t have any story to match that. Hopefully they find it hilarious now. Probably no fun at the time.

            • Zagorath@aussie.zone
              link
              fedilink
              English
              arrow-up
              1
              ·
              28 days ago

              I once watched an engineer blow up a $200k prototype with a terminal alias.

              I once worked with someone who accidentally deleted our company’s entire Git server. We had backups thankfully, but they were nearly a week old.

              Thank the gods for git being distributed, so the vast majority of the work from the last week was recoverable because it was on someone’s machine locally.

      • dave@feddit.uk
        link
        fedilink
        English
        arrow-up
        7
        ·
        1 month ago

        So I’m normally a command line fan and have used git there. But I’m also using sublimerge and honestly I find it fantastic for untangling a bunch of changes that need to be in several commits; being able to quickly scroll through all the changed files, expand & collapse the diffs, select files, hunks, and lines directly in the gui for staging, etc. I can’t see that being any faster / easier on the command line.

        • MajorasMaskForever@lemmy.world
          link
          fedilink
          English
          arrow-up
          3
          ·
          1 month ago

          Heh, I guess this shows my corporate software dev experience. Whenever I’ve taught git workflows it was always paired with a work ticketing system where any changes you were making were ideally all one single set of changes. If you need a feature or bug fix someone else was doing that was being done on another branch which you could pull into your code early and for tracking purposes we always made sure the other person merged into main first. The only time I’ve seen per line manipulation with git was when someone made a ton of changes in a file and wanted to revert a handful of lines.

          Everything else you mentioned I’ve had a web git host like gitlab or bitbucket for, but I kinda put that more into peer review workflow than git itself

        • MajorHavoc
          link
          fedilink
          arrow-up
          4
          ·
          edit-2
          1 month ago

          Welcome to the brotherhood. Haha. Ow.

          Using SVN was like a having a thoughtful professional assistant who ignored half of what I said and occasionally threw medium sized objects at my head without warning.

          You’re allowed to mock the whole organization mercilessly until they upgrade to git. Git is completely free, and the available upgrade tools are lossless. Also git actually works perfectly fine when naively treated like SVN.

          Source: I used git naively like SVN for awhile after (flawlessly) upgrading a huge number of repositories.

      • _____@lemm.ee
        link
        fedilink
        English
        arrow-up
        3
        ·
        1 month ago

        that’s exactly why I’m saying this. I know from experience helping other devs with git issues it’s always because they’re using a GUI alternative to the CLI and they’re clicking on things they don’t understand

      • BatmanAoD
        link
        fedilink
        arrow-up
        1
        ·
        29 days ago

        Tortoise git is probably what convinced me to just use the CLI for everything back in the day. Tortoise SVN is basically 1:1 with the SVN CLI (as far as I could tell, at least); Tortoise Git was…not.

        Maybe other git UIs are better. I hope so! Maybe even Tortoise has gotten better. But it was not good back then. (This was around 2013.)

    • Piatro
      link
      fedilink
      English
      arrow-up
      11
      ·
      1 month ago

      The main draw to the CLI for me is portability. I’ve been a dev for ten years now and used tons of different editors on different platforms and while each one had a different way to describe the changes, how to commit, or how to “sync” (shudder), the CLI hasn’t changed. I didn’t have to relearn a vital part of my workflow just because I wanted to try a different editor.

    • Atlas_@lemmy.world
      link
      fedilink
      arrow-up
      9
      arrow-down
      1
      ·
      1 month ago

      For a first step you can get away with just add, commit, push, and pull. Maybe reset, but tbh using git like svn at first is fine.

      Next branch, checkout and merge. At this point show, log, bisect and blame also start to be useful.

      I’m not a fan of stash, and would instead recommend reflog and cherry-pick as the first two advanced commands to learn. Then rebase and squash.

    • Cethin@lemmy.zip
      link
      fedilink
      English
      arrow-up
      7
      ·
      edit-2
      1 month ago

      Personally, I’m pretty good with the CLI version, but sometimes I just use the Code VC interface. For some tasks (basic commit, pull, push) it’s pretty fast. I don’t know if it’s faster than CLI, but I switch between them depending on what I’m doing at that moment. Code has a built in console, so using either is pretty seemless and easy. If you only use the GUI you won’t ever understand it though. I think everyone should start with CLI.

      Honestly, this is true for almost everything. GUIs obfiscate. They don’t help you learn, but try to take control away so you can’t mess up, and as an effect can’t do everything you may want.

    • thebestaquaman@lemmy.world
      link
      fedilink
      arrow-up
      7
      ·
      1 month ago

      I use gitkraken for two primary purposes:

      1. Having a visual representation of my project history.

      2. resolving merge conflicts

      Of these, the first is really the only thing I really want a GUI for. I’ll just have it open on my side-screen if I’m managing some more or less messy branch structure or quickly want an overview of what has been done on which branches, where common ancestors are, etc. All the actual doing of things is done from the CLI, because it’s just better for that.

    • CodeMonkey
      link
      fedilink
      arrow-up
      1
      ·
      1 month ago

      For me, it is easier to learn to use git via CLI instead of a UI. When I first started using git, I learned a few command/flag combinations that I use every day and I barely learned anything else about git after. Everything I don’t do regularly I don’t remember, but have written down in a text file of incantations. It is harder to write down what buttons and what menus I have to click.

    • apostrofail@lemmy.world
      link
      fedilink
      arrow-up
      9
      arrow-down
      8
      ·
      1 month ago

      How about Git’s CLI stop being so shit? All of the options are obtuse & usually 3 ways to do the same thing.

      Developers should normalize non-Git DVCSs.