Beehaw
  • Communities
  • Create Post
  • search
    Search
  • Login
  • Sign Up
sag ( sag@lemm.ee )  to Programmer Humor@programming.dev · 3 years ago

My Git Knowledge

lemm.ee

message-square
61
link
fedilink
659

My Git Knowledge

lemm.ee

sag ( sag@lemm.ee )  to Programmer Humor@programming.dev · 3 years ago
message-square
61
link
fedilink
alert-triangle
You must log in or # to comment.
  • redcalcium ( redcalcium@lemmy.institute ) 
    link
    fedilink
    arrow-up
    117
    ·
    3 years ago

    Interviewer: It’s git push origin main now. Get out of here!

    • Cyborganism ( cyborganism@lemmy.ca ) 
      link
      fedilink
      arrow-up
      12
      ·
      3 years ago

      Just set your default behavior.

      • OpenStars ( OpenStars@startrek.website ) 
        link
        fedilink
        English
        arrow-up
        20
        ·
        3 years 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.

        • synae[he/him] ( synae@lemmy.sdf.org ) 
          link
          fedilink
          English
          arrow-up
          5
          ·
          3 years ago

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

          • OpenStars ( OpenStars@startrek.website ) 
            link
            fedilink
            English
            arrow-up
            5
            ·
            3 years 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

        • sag ( sag@lemm.ee ) OP
          link
          fedilink
          arrow-up
          5
          ·
          3 years ago

          Hold Up

          • body_by_make ( Cqrd@lemmy.dbzer0.com ) 
            link
            fedilink
            arrow-up
            18
            ·
            3 years 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

            • sag ( sag@lemm.ee ) OP
              link
              fedilink
              arrow-up
              4
              ·
              3 years ago

              Thanks didn’t know that

              • bleistift2 ( bleistift2@feddit.de ) 
                link
                fedilink
                English
                arrow-up
                5
                ·
                3 years 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 ( PoolloverNathan@programming.dev ) 
            link
            fedilink
            arrow-up
            10
            ·
            3 years 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 ( blind3rdeye@lemm.ee ) 
              link
              fedilink
              arrow-up
              4
              ·
              3 years 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 ( embed_me@programming.dev ) 
                link
                fedilink
                arrow-up
                1
                ·
                3 years ago

                That’s a signal for me to

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

                ( I have changed)

  • andreluis034 ( andreluis034@bookwormstory.social ) 
    link
    fedilink
    English
    arrow-up
    39
    ·
    3 years ago

    I once had HR ask if I was familiar with G-I-T ( she spelled it out), for a moment, my only thought was “wtf is G-I-T”.

    • dQw4w9WgXcQ ( dQw4w9WgXcQ@lemm.ee ) 
      link
      fedilink
      arrow-up
      35
      ·
      3 years 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.”

    • fahfahfahfah ( fahfahfahfah@lemmy.billiam.net ) 
      link
      fedilink
      English
      arrow-up
      12
      ·
      3 years ago

      One of my first interviews in Canada I was asked what a “zed-index” is and was like what? A what now?

      • Gestrid ( Gestrid@lemmy.ca ) 
        link
        fedilink
        English
        arrow-up
        4
        ·
        edit-2
        3 years 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 ( allywilson@sopuli.xyz ) 
          link
          fedilink
          arrow-up
          3
          ·
          3 years 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 ( Gestrid@lemmy.ca ) 
            link
            fedilink
            English
            arrow-up
            3
            ·
            3 years 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)) ( RiikkaTheIcePrincess@pawb.social ) 
      link
      fedilink
      English
      arrow-up
      1
      ·
      3 years ago

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

  • chicken ( chicken@lemmy.dbzer0.com ) 
    link
    fedilink
    arrow-up
    23
    ·
    3 years ago

    If you happen to forget the -m though, you may also need to have mastered exiting vim

    • JATtho ( JATtho@sopuli.xyz ) 
      link
      fedilink
      arrow-up
      3
      ·
      3 years 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 ( cyborganism@lemmy.ca ) 
    link
    fedilink
    arrow-up
    21
    ·
    3 years 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 ( zaphod@lemmy.ca ) 
      link
      fedilink
      English
      arrow-up
      8
      ·
      3 years 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 ( cyborganism@lemmy.ca ) 
        link
        fedilink
        arrow-up
        2
        ·
        3 years ago

        Right. I just wanted to keep it as simple as possible.

        • zaphod ( zaphod@lemmy.ca ) 
          link
          fedilink
          English
          arrow-up
          3
          ·
          3 years ago

          Oh, no worries, just figured I’d add that extra little bit of detail as it’s a useful hook into a lot of other git concepts.

        • embed_me ( embed_me@programming.dev ) 
          link
          fedilink
          arrow-up
          1
          ·
          3 years ago

          Honestly I’ve come to realise that being precise is the simplest in the long run

          • spikespaz ( spikespaz@programming.dev ) 
            link
            fedilink
            arrow-up
            1
            ·
            3 years ago

            People get overloaded with words. You have to focus on one concept at a time. Let them ask for others.

    • Doc Avid Mornington ( docAvid@midwest.social ) 
      link
      fedilink
      English
      arrow-up
      4
      ·
      3 years ago

      Orphaned commits can get garbage collected at some point, though.

      • Cyborganism ( cyborganism@lemmy.ca ) 
        link
        fedilink
        arrow-up
        2
        ·
        edit-2
        3 years 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 ( docAvid@midwest.social ) 
          link
          fedilink
          English
          arrow-up
          2
          ·
          3 years 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.

    • uis ( uis@lemm.ee ) 
      link
      fedilink
      arrow-up
      1
      ·
      3 years ago

      This I call decapitation

  • CronyAkatsuki ( crony@lemmy.cronyakatsuki.xyz ) 
    link
    fedilink
    arrow-up
    15
    ·
    edit-2
    3 years ago

    Average linux user managing his dotfiles.

    Yes I’m guilty of that, only thing more I know is creating new branches.

  • ramjambamalam ( ramjambamalam@lemmy.ca ) 
    link
    fedilink
    arrow-up
    15
    ·
    3 years ago

    git gud

  • YTG123 ( ytg@feddit.ch ) 
    link
    fedilink
    arrow-up
    10
    ·
    3 years 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.

  • SomeBoyo ( SomeBoyo@feddit.de ) 
    link
    fedilink
    arrow-up
    10
    ·
    3 years ago

    git blame is another good one

    • Laurel Raven ( laurelraven@lemmy.blahaj.zone ) 
      link
      fedilink
      arrow-up
      4
      ·
      3 years ago

      Yes, I think we all like to blame git

  • darkpanda ( darkpanda@lemmy.ca ) 
    link
    fedilink
    arrow-up
    9
    ·
    3 years 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 ( xthexder@l.sw0.com ) 
      link
      fedilink
      arrow-up
      7
      ·
      3 years 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 ( BehindTheBarrier@programming.dev ) 
    link
    fedilink
    arrow-up
    8
    ·
    3 years 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 ( EatATaco@lemm.ee ) 
      link
      fedilink
      English
      arrow-up
      1
      ·
      3 years 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.

  • Ephera ( Ephera@lemmy.ml ) 
    link
    fedilink
    arrow-up
    7
    ·
    3 years ago

    Well, if anyone wants to learn more about Git, I can recommend this: https://ohmygit.org

  • gazter ( gazter@aussie.zone ) 
    link
    fedilink
    arrow-up
    6
    ·
    3 years ago

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

    • Laurel Raven ( laurelraven@lemmy.blahaj.zone ) 
      link
      fedilink
      arrow-up
      13
      ·
      3 years 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 ( lhamil64@programming.dev ) 
        link
        fedilink
        arrow-up
        9
        ·
        3 years 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…

        • MrRazamataz ( MrRazamataz@lemmy.razbot.xyz ) 
          link
          fedilink
          English
          arrow-up
          13
          ·
          3 years ago

          what. that’s not what they said. they are comparing git knowledge to regex knowledge.

          • Astongt615 ( Astongt615@lemmy.one ) 
            link
            fedilink
            arrow-up
            7
            ·
            3 years ago

            Ah, thanks for the explanation. I too misunderstood the inflection.

            • MrRazamataz ( MrRazamataz@lemmy.razbot.xyz ) 
              link
              fedilink
              English
              arrow-up
              1
              ·
              3 years ago

              no worries

        • Laurel Raven ( laurelraven@lemmy.blahaj.zone ) 
          link
          fedilink
          arrow-up
          2
          ·
          3 years ago

          I don’t even know how to respond to this considering it has nothing to do with what I said…

          • survivalmachine ( survivalmachine@beehaw.org ) 
            link
            fedilink
            arrow-up
            3
            ·
            3 years ago

            There are at least two ways to parse your statement, and they interpreted it differently from your intention.

            • Laurel Raven ( laurelraven@lemmy.blahaj.zone ) 
              link
              fedilink
              arrow-up
              2
              ·
              3 years ago

              I guess, if you ignore the comma…

              • lhamil64 ( lhamil64@programming.dev ) 
                link
                fedilink
                arrow-up
                2
                ·
                3 years 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.

                • Laurel Raven ( laurelraven@lemmy.blahaj.zone ) 
                  link
                  fedilink
                  arrow-up
                  2
                  ·
                  3 years 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

  • Paulemeister ( Paulemeister@feddit.de ) 
    link
    fedilink
    arrow-up
    5
    ·
    3 years ago

    git commit -am

    • uis ( uis@lemm.ee ) 
      link
      fedilink
      arrow-up
      1
      ·
      edit-2
      3 years ago

      You don’t just git to edit past commit

  • Kühe sind toll ( cows_are_underrated@feddit.de ) 
    link
    fedilink
    arrow-up
    5
    ·
    3 years ago

    Gut clone

    • Cwilliams ( Cwilliams@beehaw.org ) 
      link
      fedilink
      arrow-up
      6
      ·
      3 years ago
      cat ~/.bash_history | grep "gut add" | wc -l
      

      I’ve typed that more times than I thought…

      • dan ( dan@upvote.au ) 
        link
        fedilink
        arrow-up
        5
        ·
        3 years ago

        alias gut=git

        • uis ( uis@lemm.ee ) 
          link
          fedilink
          arrow-up
          2
          ·
          3 years ago

          echo alias gut=git >> ~/.bashrc

  • psivchaz ( psivchaz@reddthat.com ) 
    link
    fedilink
    arrow-up
    3
    ·
    3 years 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

    • SpaceCowboy ( SpaceCowboy@lemmy.ca ) 
      link
      fedilink
      arrow-up
      2
      ·
      3 years ago

      Pffft… all of my api keys are open source. Having more eyes on them will make them more secure!

Programmer Humor@programming.dev

programmer_humor@programming.dev

Subscribe from Remote Instance

Create a post
You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: !programmer_humor@programming.dev

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

  • Keep content in english
  • No advertisements
  • Posts must be related to programming or programmer topics
    • If the mod doesn’t find it funny, you’re banned. Ha-ha!.. For real: do not use the community for “statements”. There are other places for such content. Keep it chill and funny.
Visibility: Public
globe

This community can be federated to other instances and be posted/commented in by their users.

  • 1.72K users / day
  • 2.71K users / week
  • 4.28K users / month
  • 7.73K users / 6 months
  • 462 local subscribers
  • 33.7K subscribers
  • 1.58K Posts
  • 25.9K Comments
  • Modlog
  • mods:
  • Feyter ( Feyter@programming.dev ) 
  • adr1an ( anzo@programming.dev ) 
  • BurningTurtle ( BurningTurtle@programming.dev ) 
  • Pierre-Yves Lapersonne ( pylapp@programming.dev ) 
  • BE: 0.19.15
  • Modlog
  • Legal
  • Instances
  • Docs
  • Code