• Trollception@lemmy.world
      link
      fedilink
      arrow-up
      0
      ·
      7 months ago

      What developer uses Linux in professional work? Maybe for on the side stuff but I haven’t seen any corporate Linux machines.

      • Solemn@lemmy.dbzer0.com
        link
        fedilink
        English
        arrow-up
        0
        ·
        7 months ago

        Everywhere I’ve worked, you have a Windows/Mac for emails, and then either use WSL, develop on console in Mac since it’s Linux, or most commonly have a dedicated Linux box or workstation.

        I’m starting to see people using VSCode more these days though.

          • Solemn@lemmy.dbzer0.com
            link
            fedilink
            English
            arrow-up
            0
            ·
            7 months ago

            I think someone else said what it actually is in another comment. It’s functionally identical 90℅ of the time for me anyway,and I use CLI and vim on it.

          • Ephera@lemmy.ml
            link
            fedilink
            arrow-up
            0
            ·
            7 months ago

            They’re both UNIX-like, i.e. they both implement the POSIX specification and are therefore in many ways compatible.

            But yeah, modern macOS is more directly derived from the original UNIX operating system.
            Linux was instead implemented from scratch to be compatible with UNIX.

      • aodhsishaj@lemmy.world
        link
        fedilink
        arrow-up
        0
        ·
        7 months ago

        Hello, I use a linux machine for dev work and all the servers and containers I touch are linux, all managed through gitlab CI/CD.

        git scm is my daily driver and I use it for not taking and documentation as well as active python development.

      • Ephera@lemmy.ml
        link
        fedilink
        arrow-up
        0
        ·
        7 months ago

        The entire IT ecosystem is built around Linux, because it’s so prevalent in servers, containers, budget hardware and the open-source community.

        Yes, many companies don’t understand that and expect their devs to be productive on Windows. But in my experience, that’s an uphill battle.

        In my company, we get very little IT support, if we decide to order a Linux laptop and we still have significantly less trouble with getting things set up to start coding.
        Not to mention the productivity boost from having all the relevant technologies natively available + being able to script whatever you want.

    • jxk@sh.itjust.works
      link
      fedilink
      arrow-up
      0
      ·
      7 months ago

      Me as an Emacs user, who omits -m on purpose to practice quitting vi in case I really need it

    • JATtho@sopuli.xyz
      link
      fedilink
      arrow-up
      0
      ·
      7 months ago

      The day I configured git to use Geany for commit messages with a separate config specifically tuned for this, it improved my life by 300%

      ~$ cat ~/bin/gitedit
      #!/bin/sh
      exec /usr/bin/geany -i -s -t -c ~/.config/gitgeany $@
      

      Then in git config: git config --global core.editor "gitedit"

  • gazter@aussie.zone
    link
    fedilink
    arrow-up
    0
    ·
    7 months ago

    As someone who knows that they know very little about git, this thread makes me think I’m not alone.

    • laurelraven@lemmy.blahaj.zone
      link
      fedilink
      arrow-up
      0
      ·
      7 months ago

      I think advanced git knowledge, like RegEx, is the exception, while the norm is to know the tiny handful of day to day useful bits

      • lhamil64@programming.dev
        link
        fedilink
        arrow-up
        0
        ·
        7 months ago

        How is regex git knowledge? I guess you can use regular expressions with git grep but it’s certainly not a git-oriented concept…

              • lhamil64@programming.dev
                link
                fedilink
                arrow-up
                0
                ·
                7 months ago

                Rereading it, I now understand what you meant. I interpreted the “like regex” as an example of advanced git knowledge. I’m not sure the comma helps make it unambiguous though.

                • laurelraven@lemmy.blahaj.zone
                  link
                  fedilink
                  arrow-up
                  0
                  ·
                  7 months ago

                  Yeah, reading it again and I can see that interpretation…

                  This is why you shouldn’t rely on yourself alone for proofreading your writing, I probably could have read that a hundred times and not seen another way to read it without someone else pointing it out

    • Deebster@programming.dev
      link
      fedilink
      English
      arrow-up
      0
      ·
      7 months ago

      The commands are notoriously poorly named. The underlying tech is cool and sensible, the text interface isn’t.

    • 4am@lemm.ee
      link
      fedilink
      arrow-up
      0
      ·
      7 months ago

      Just need more terminal time, it comes with experience.

      You should run Arch, btw

  • Ohi@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    7 months ago

    Aye, most of my 10 year career in web dev is pretty much those commands. However, some advanced git concepts are worth diving into. Stuff like git bisect that can narrow down the exact commit that broke your app is an absolute life saver. Knowing how to git cherry-pick is also a git skill professionals should be comfortable doing. Migrating work from one branch to another without merging the entire branch is pretty common.

  • YTG123@feddit.ch
    link
    fedilink
    arrow-up
    0
    ·
    7 months ago

    Every once in a while, you can refresh your memory by reading the man page.

    Or if, like me, you use Emacs, Magit exposes everything quite clearly.

  • samus12345@lemmy.world
    link
    fedilink
    English
    arrow-up
    0
    ·
    7 months ago

    Seeing Peter Griffin labelled as “HR”, I automatically pronounce the R as “Ah” in my head.

  • Marcbmann@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    7 months ago

    I think HR is just ill equipped for technical interviews, but they try to conduct them regardless.

    Was denied a position because HR felt my experience “lacked depth” which I still can’t understand 3 years later.

    Did the same role at a larger company. Had more responsibility than they were giving me. Developed my own tools for job automation. Grew their business from nothing to half a mil a month. Experienced all stages of growth and realized massive success.

    After that interview I kept getting technical interviews and getting passed on because I was too senior for the position

  • Cyborganism@lemmy.ca
    link
    fedilink
    arrow-up
    0
    ·
    7 months ago

    Once you understand that everything is similar to a tag, like branch names are basically tags that move forward with each commit, that HEAD is a tag that points to your current commit location in history, and what command moves what kind of tag, it becomes easier to understand.

    Suddenly having a detached HEAD isn’t as scary as you might think. You get a better understanding of fast forward merges vs regular 3-way merge.

    Also understanding that each commit is unique and will always remain in the history and can be recovered using special commands. Nothing is lost in git, unless you delete the .git sub-directory.

    • zaphod@lemmy.ca
      link
      fedilink
      English
      arrow-up
      0
      ·
      7 months ago

      For folks unaware, the technical git term, here, is a ‘ref’. Everything that points to a commit is a ref, whether it’s HEAD, the tip of a branch, or a tag. If the git manpage mentions a ‘ref’ that’s what it’s talking about.

      • Cyborganism@lemmy.ca
        link
        fedilink
        arrow-up
        0
        ·
        edit-2
        7 months ago

        Oh fuck. I didn’t think of that. Than you for reminding me.

        Edit: Ah but you can only run this in your local repo. If you happen to push anything, you might not be able to run it on the remote. Many DevOps platforms won’t allow it.

        • Doc Avid Mornington@midwest.social
          link
          fedilink
          English
          arrow-up
          0
          ·
          7 months ago

          Oh yeah, and anybody else who had fetched in those commits may still have them as well. It’s hard for something to be gone-gone, but it may be annoyingly-hard-to-recover-gone.

        • zalgotext@sh.itjust.works
          link
          fedilink
          arrow-up
          0
          ·
          7 months ago

          Imma be honest I pulled that estimate out of my ass lol, but I feel like it was pre-pandemic? which would put it at at least 4 years ago and so holy shit I’m gonna go cry in a corner because it’s been 4 years since the start of the pandemic

      • throwwyacc@lemmynsfw.com
        link
        fedilink
        arrow-up
        0
        ·
        7 months ago

        Isn’t this only the case in github? All my repos are based from master, and I would assume that’s because I init on the command line and push up to the remote?

        • AA5B@lemmy.world
          link
          fedilink
          arrow-up
          0
          ·
          7 months ago

          GitLab also changed a few years back. We host our own, so got the update later than people using the service … it was a bit of an argument at first since everyone wanted to stick with the familiar, but laziness won out. Unfortunately, it’s not really justifiable to go back and change legacy projects, so now it’s inconsistent

          • throwwyacc@lemmynsfw.com
            link
            fedilink
            arrow-up
            0
            ·
            7 months ago

            If you don’t have any scripts that rely on branch name it should be pretty trivial actually. But I wouldn’t be shocked if you had a few dozen scripts that nobody has looked at in the last century lol

      • TunaCowboy@lemmy.world
        link
        fedilink
        arrow-up
        0
        ·
        7 months ago

        You should not be pushing into your main/master/whatever branch.

        All the main/master replies completely miss the point, further emphasizing sirsirsalot’s statement.

  • darkpanda@lemmy.ca
    link
    fedilink
    arrow-up
    0
    ·
    7 months ago

    Learn to use git bisect. If you have unit tests, which of course you should, it can save you so much time finding weird breakages.

    • xthexder@l.sw0.com
      link
      fedilink
      arrow-up
      0
      ·
      7 months ago

      With automated CI, I’ve had very few times where bisect is useful. Either the bug was introduced 1-2 commits ago, or it’s always been there and the exact commit is irrelevant to the solution, since you just fix it forward.

  • psivchaz@reddthat.com
    link
    fedilink
    arrow-up
    0
    ·
    7 months ago

    All these comments and no one is going to point out that this is invalid?

    The git stage and git commit don’t have any terminator, so it’s all one “command” and will fail. Then there’s a single & between git commit and git push, so it would run in parallel, so it would also fail.

    Also, don’t git stage . people. Or at least do a git status before to make sure you didn’t stage file-with-all-the-production-secrets

  • Punkie@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    7 months ago

    The thing is that for a majority of cases, this is all one needs to know about git for their job. Knowing git add, git -m commit “Change text”, git push, git branch, git checkout , is most of what a lone programmer does on their code.

    Where it gets complicated real fast is collaboration on the same branch. Merge conflicts, outdated pulls, “clever shortcuts,” hacks done by programmers who “kindof” know git at an advanced level, those who don’t understand “least surprise,” and those who cut and paste fixes from Stackexchange or ChatGPT. Plus who has admin access to “undo your changes” so all that work you did and pushed is erased and there’s no record of it anymore. And egos of programmers who refuse any changes you make for weird esoteric reasons. I had a programmer lead who rejected any and all code with comments “because I like clean code. If it’s not in the git log, it’s not a comment.” And his git comments were frustratingly vague and brief. “Fixed issue with ssl python libs,” or “Minor bugfixes.”

    • Ekky@sopuli.xyz
      link
      fedilink
      English
      arrow-up
      0
      ·
      7 months ago

      “Fixed issue with ssl python libs,” or “Minor bugfixes.”

      Red bird going "Hahaha, No!"

      In other news, never work more than one person on a branch (that’s why we have them). Make a new related issue with its own branch and rebase whenever necessary, and don’t even think about touching main or dev with anything but a properly reviewed and approved PR (in case they aren’t already protected), or I’ll find and report you to the same authority that handles all the failed sudo requests!

      Also, companies that disable rebasing are my bane. While you can absolutely do without, i much prefer to have less conflicts, cleaner branches and commits, easier method to pull in new changes from dev, overall better times for the reviewer, and the list goes on. Though, the intern rewriting multiple branches’ history which they have no business pushing to is also rather annoying.

      • seth@lemmy.world
        link
        fedilink
        arrow-up
        0
        ·
        7 months ago

        I hate when helpful features like hook scripts aren’t enabled. Someone forgot to run a script before pushing their changes even though the readme clearly says to format, lint, and confirm unit tests all pass before pushing, and now the PR has 100 irrelevant whitespace changes that are going to be reverted by the next pull request. A pre-commit script could gate that and auto fix it but noooo, admins don’t want to turn on a feature they don’t use.

    • Ottomateeverything@lemmy.world
      link
      fedilink
      arrow-up
      0
      ·
      7 months ago

      I had a programmer lead who rejected any and all code with comments “because I like clean code. If it’s not in the git log, it’s not a comment.”

      Pretty sure I would quit on the spot. Clearly doesn’t understand “clean” code, nor how people are going to interface with code, or git for that matter. Even if you write a book for each commit, that would be so hard to track down relevant info.

      • mkwt@lemmy.world
        link
        fedilink
        arrow-up
        0
        ·
        7 months ago

        Yeah, I think that guy only got a superficial understanding of what Uncle Bob was saying.

        My policy as a tech lead is this: In an ideal world, you don’t need the comment because the names and the flow are good. But when you do need the comments, you usually really need those comments. Anything that’s surprising, unusual, or possibly difficult to understand gets comments. Because sometimes the world is not ideal, and we don’t have the time or energy to fully express our ideas clearly in code.

        My policy on SCM logs is that they should be geared more towards why this commit is going in, not what is being done. And what other tickets, stories, bugs it relates to.

        • bleistift2@feddit.de
          link
          fedilink
          English
          arrow-up
          0
          ·
          7 months ago

          But when you do need the comments, you usually really need those comments.

          It’s nice to see you sharing my experience. My code is either uncommented or very severely commented with comment-to-code ratios of 10:1 or more. I hate the files that are soo green… :(

        • PrettyFlyForAFatGuy@lemmy.ml
          link
          fedilink
          arrow-up
          0
          ·
          7 months ago

          Lead of a small team of scripters here. The “Why. Not What” is defo a good way of encouraging cleaner code.

          Had to request changes recently on a PR like this, big function with comments telling me what it was doing. When they resubmitted for review they had broken it down into smaller functions with good variable/function naming. following what was going on was much easier

        • AstridWipenaugh@lemmy.world
          link
          fedilink
          arrow-up
          0
          ·
          7 months ago

          We solve that problem using naming conventions. Branch names must start with the issue key (we use Jira). You don’t do anything in that branch that’s not part of that issue. If you do, you must prefix the commit message with the issue key that it goes with. The commit itself identifies what changed. The Jira issue provides all the backstory and links to any supporting materials (design docs, support tickets, etc). I have to do a lot of git archeology in my role, and this scheme regularly allows me to figure out why a code change was made years ago without ever talking to anyone.

          • AA5B@lemmy.world
            link
            fedilink
            arrow-up
            0
            ·
            7 months ago

            To be honest, when I ask a candidate about git, I’m looking for them to describe this workflow.

            Heck, I have a new person who I tasked with minor config change, just to make sure she knows how to use git in a professional environment

    • bleistift2@feddit.de
      link
      fedilink
      English
      arrow-up
      0
      ·
      7 months ago

      If it’s not in the git log, it’s not a comment.”

      This is so incredibly dumb, though I’m sure I don’t have to tell you this. That comment will be buried in the git log if anyone ever fixes a typo on that line.

    • Valmond@lemmy.mindoki.com
      link
      fedilink
      arrow-up
      0
      ·
      7 months ago

      Why does

      git rebase

      work sometimes?

      Yeah git can get quite complicated when there ate lots of people working on the same things.

      • mkwt@lemmy.world
        link
        fedilink
        arrow-up
        0
        ·
        7 months ago

        It’s not git that’s complicated. The work is complicated. git is just one of the tools that programmers use to manage the complexity.

        I also think that some people get too hung up on having a “clean” history, and trying to “fix” the history after it has already occurred. I usually have enough problems to worry about in the present, without also trying to worry about the past.

        • zqwzzle@lemmy.ca
          link
          fedilink
          English
          arrow-up
          0
          ·
          7 months ago

          I like to rebase on my feature branches before the PR because it’s a gift to my future self that resolves all the conflicts (if any) before my work goes in. I just find trying to figure out how those conflicts got resolved when there are a bunch of merges in more difficult if there’s a problem later. It’s easier to understand for me. YMMV, this does not work for everyone. Etc etc.

        • Wrench@lemmy.world
          link
          fedilink
          arrow-up
          0
          ·
          7 months ago

          I find the “clean history” argument so flawed.

          Sure, if you’re they type to micro commit, you can squash your branch and clean it up before merging. We don’t need a dozen “fixed tests” commits for context.

          But in practice, I have seen multiple teams with the policy of squash merging every branch with 0 exceptions. Even going so far as squash merging development branches to master, which then lumps 20 different changes into a single commit. Sure, you can always be a git archeologist, check out specific revisions, see the original commits, and dig down the history over and over, to get the original context of the specific change you’re looking into. But that’s way fucking more overhead than just looking at an unmanipulated history and seeing the parallel work going on, and get a clue on context at a glance at the network graph.

          • GissaMittJobb@lemmy.ml
            link
            fedilink
            arrow-up
            0
            ·
            7 months ago

            Using curated commits to optimize for pull request reviewability is highly underrated. Liberal use of interactive rebasing to ‘tell a story’, essentially.

          • andioop@programming.dev
            link
            fedilink
            English
            arrow-up
            0
            ·
            7 months ago

            you’re they type to micro commit

            Thanks for a much shorter and better way to explain this tendency of mine and why I rebase a lot, yoinking this phrase.