• OpenStars@startrek.website
        link
        fedilink
        English
        arrow-up
        21
        ·
        1 year ago

        I have only ever used simply “git push”. I feel like this is a “how to say that you barely know how to use git without saying that you barely know how to use git” moment:-D.

          • body_by_make@lemmy.dbzer0.com
            link
            fedilink
            arrow-up
            19
            ·
            edit-2
            1 year ago

            You can default git to using your current branch and a specific upstream so you don’t have to put anything after git push

              • bleistift2@feddit.de
                link
                fedilink
                English
                arrow-up
                5
                arrow-down
                1
                ·
                1 year ago

                Has git never told you that you should use git push -u origin when you push a new branch for the first time?

          • PoolloverNathan@programming.dev
            link
            fedilink
            arrow-up
            11
            ·
            1 year ago

            The first time you manually push like that, you can add the -u flag (git push -u origin master) to push and set the branch’s default upstream. Afterwards, a plain git push while that branch is checked out will push the branch to that default upstream. This is per-branch, so you can have a main branch that pulls from one repository and a patch branch that pulls and pushes to a different repository.

            • blind3rdeye@lemm.ee
              link
              fedilink
              arrow-up
              4
              ·
              1 year ago

              My strategy is to just type git push and get some kind of error message about upstream not being set or something. That’s a signal for me to take a second to think about what I’m actually doing and type the correct command.

              • embed_me@programming.dev
                link
                fedilink
                arrow-up
                1
                ·
                1 year ago

                That’s a signal for me to

                … google the error and randomly try stack overflow answers without really understanding them.

                ( I have changed)

        • synae[he/him]@lemmy.sdf.org
          link
          fedilink
          English
          arrow-up
          6
          ·
          1 year ago

          Normal distribution curve meme makes sense here - experts and noobs can both git push safely (but for different reasons)

          • OpenStars@startrek.website
            link
            fedilink
            English
            arrow-up
            6
            arrow-down
            1
            ·
            1 year ago

            I can follow along re-typing the same commands told to me by a more senior dev just like any average monkey!

            This reminds me of something I made a long time ago: img

            Since I am calling myself dumb, I estimate my progress to be somewhere perhaps at the 20th percentile marker? :-D One of these days I’ll RTFM and rocket all the way up to be dumb enough to properly qualify for “below average”! :-P

      • redcalcium@lemmy.institute
        link
        fedilink
        arrow-up
        2
        ·
        1 year ago

        Employees who push first win and get to leave early. The rest would be the suckers who would merge whatever mess left behind by the early employees.

      • MR_GABARISE@lemmy.world
        link
        fedilink
        arrow-up
        1
        ·
        1 year ago

        What kind of wild west operation allows pushing directly to main?

        That’s kinda the whole point of trunk-based development.

    • RustyNova@lemmy.world
      link
      fedilink
      arrow-up
      1
      ·
      1 year ago

      Fuck those that use main. If you’re working on a library fork that has main and a project that has master you’re bound to invert the two.

      “What do you mean I can’t checkout main? Oh right, here it’s master…”

      For once that we had a standard, it had to be ruined.

      • 1984@lemmy.today
        link
        fedilink
        arrow-up
        1
        ·
        edit-2
        1 year ago

        I think the reasons was ridiculous. The fact that people didn’t like the word master anymore. But I’m used to it now, so fine, let’s use main. It makes sensitive people feel better.

      • huginn@feddit.it
        link
        fedilink
        arrow-up
        0
        arrow-down
        1
        ·
        1 year ago

        Fuck those that use master. If you’re working on a library fork that has main and a project that has master you’re bound to invert the two.

        “What do you mean I can’t checkout main? Oh right, here it’s master…”

        For once that we had a standard, it had to be ruined.

        The standard is now main.

        • maynarkh@feddit.nl
          link
          fedilink
          arrow-up
          2
          ·
          1 year ago

          The standard is now main.

          Git itself does not use that standard yet, so at least now there are two competing standards.

          I get that there are cultural reasons why the word master was loaded language, but still, it’s not like institutional racism will go away. Meanwhile, the rest of the world which doesn’t struggle with the remnants of slavery has to put up with US weirdness.

          • zalgotext@sh.itjust.works
            link
            fedilink
            arrow-up
            0
            ·
            1 year ago

            Git itself does not use that standard yet, so at least now there are two competing standards.

            Just ran git init in a brand new empty directory, and while it did create a master branch by default, it also printed out a very descriptive message explaining how you can change that branch name, how you can configure git to use something else by default, and other standards that are commonly used.

            Also, there’s nothing saying your local branch name has to match the upstream. That’s the beauty of git - you have the freedom to set it up pretty much however you want locally.

            • maynarkh@feddit.nl
              link
              fedilink
              arrow-up
              1
              ·
              1 year ago

              Yeah, that’s what I’m saying, there is no one standard now. The stupid thing is all the problems that causes is mostly because there used to be one, and stuff written assuming master branches are eternal.

              I’ve had a company that had some automation built on git but below GitLab that would not let you delete master branches. When main became a thing, they just started hard protecting those as well by name. It’s because of regulatory, and they are very stingy about it.

              So when I created a few dozen empty deployment repos with main as the default, and then had to change it over to master so that it lined up nicer with the rest of the stuff, I’ve had a few dozen orphaned undeletable empty main branches laying around. A bit frustrating.

              That said, the whole thing is just that. A bit frustrating. If it makes some people feel better about themselves, so be it. I am blessed in life enough to take “a bit frustrating”.

    • dQw4w9WgXcQ@lemm.ee
      link
      fedilink
      arrow-up
      35
      ·
      1 year ago

      I might be the dumb one in this one, but HR asked me if I know “design patterns”.

      “I mean, yes, I know some design patterns. Any specific?”

      “No, just if you are familiar with design patterns.”

      “I mean, there are builder, strategy, sigleton, factory etc. Is the question really not more specific?”

      “My paper just asks if the dev is familiar with design patterns.”

      “Ok. Yes.”

      • Gestrid@lemmy.ca
        link
        fedilink
        English
        arrow-up
        4
        ·
        edit-2
        1 year ago

        Whenever I hear someone say “zed”, it always throws me for a loop. I follow a Canadian streamer, and they use it in place of “zero” the letter “zee”.

        • allywilson@sopuli.xyz
          link
          fedilink
          arrow-up
          3
          ·
          1 year ago

          I’m not Canadian, but as a Brit I also say Zed instead of Zee but I’ve never heard someone say Zed instead of Zero. WTF.

          • Gestrid@lemmy.ca
            link
            fedilink
            English
            arrow-up
            3
            ·
            1 year ago

            Oh, my bad. It was zed instead of the letter “zee”.

            It’s 3am, and I’m exhausted, about to head to bed.

    • KeriKitty (They(/It))@pawb.social
      link
      fedilink
      English
      arrow-up
      1
      arrow-down
      1
      ·
      1 year ago

      Ahh, that must be where the DEVs use LUA and JAVA and whatever else always irks me. grumps irkily, for emphasis and illustration

    • JATtho@sopuli.xyz
      link
      fedilink
      arrow-up
      2
      ·
      1 year 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"

  • Cyborganism@lemmy.ca
    link
    fedilink
    arrow-up
    22
    ·
    1 year 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
      8
      ·
      1 year 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
        2
        ·
        edit-2
        1 year 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
          2
          ·
          1 year 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.

  • YTG123@feddit.ch
    link
    fedilink
    arrow-up
    10
    arrow-down
    1
    ·
    1 year 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.

  • darkpanda@lemmy.ca
    link
    fedilink
    arrow-up
    9
    ·
    1 year 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
      7
      ·
      1 year 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.

  • BehindTheBarrier@programming.dev
    link
    fedilink
    arrow-up
    8
    ·
    1 year ago

    I made do with my IDE, even after getting a developer job. Outside shenanigans involving a committed password, and the occasional empty commit to trigger a build job on GitHub without requiring a new review to be approved, I still don’t use the commandline a lot.

    But it’s true, if you managed to commit and push, you are OK. Even the IDE will make fixing most merges simple.

    • EatATaco@lemm.ee
      link
      fedilink
      English
      arrow-up
      1
      arrow-down
      2
      ·
      1 year ago

      These threads drive home the point that a GUI of some sort is far superior for most users. I use git kraken, but in the past I’ve used git extensions as well, and I take advantage of so much more git has to offer than pretty much everyone here.

      I swear people just want the cli to be better so they claim it is, but I really don’t get how. Especially for quickly scanning the repo, doing diffs, commiting partial files, history, blame, etc.

  • gazter@aussie.zone
    link
    fedilink
    arrow-up
    6
    ·
    1 year ago

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