• Eager Eagle@lemmy.world
    link
    fedilink
    English
    arrow-up
    42
    ·
    4 days ago

    it has always bothered me that checkout is overloaded: it can switch branches or discard pending changes in an unrecoverable way.

    so, PSA, you can replicate the safe part of checkout with git switch and the unsafe with git restore.

    • onlinepersona@programming.dev
      link
      fedilink
      arrow-up
      13
      arrow-down
      8
      ·
      4 days ago

      It wasn’t even tech bros. Some people started using opensource software, discovered the master branch and lost their shit. Nobody meaningful had ever connected the name to anything malevolent, but those people made themselves be offended in the name of people who weren’t even offended by it.

      Microsoft bought github and didn’t want the bad press so they renamed it after the twitter shitstorm. The professional victims then moved on to whatever else made noise on twitter and that was that.

      I force all new projects to use master as all my old scripts and repos use master. Twitter shitstorms scan stay where they should be: in the toilet bowl of the internet aka twitter.

      • uncouple9831@lemmy.zip
        link
        fedilink
        arrow-up
        1
        ·
        edit-2
        3 days ago

        I don’t remember every detail but what I do remember is the wave starting with pre-elon Twitter devs announcing their changes and it started with web services that had master/slave terminology. Some of the new terms did make more sense, but some were clearly stretches. And twitter being based out of SF probably has put forth the effort to hire maybe 5 to 6 black people over it’s entire existence, so it felt especially shallow to me at the time. Hence the comment. Obviously there’s some assumptions there about twitters hiring practice but…I really don’t think I’m wrong, there’s definitely a cultural issue out there in the bay.

  • majster@lemmy.zip
    link
    fedilink
    English
    arrow-up
    15
    ·
    4 days ago

    I still see master branches everywhere, even my new personal repos. This git renaming story is one of the most stupid OSS pushes I remember. That and Gimp fork, that then died out I think.

  • Zagorath@aussie.zone
    link
    fedilink
    English
    arrow-up
    9
    ·
    4 days ago
    Transcription

    The “It’s an Older Meme, But It Checks Out” meme, featuring an image of an Imperial officer from Star Wars, with the caption:

    It’s an older branch, sir

    But it checks out

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

    I usually create new repos through GitHub or another central repo’s system, where it defaults to calling the main branch main. But I did recently create a new repo with my local Git’s git init, and had to deal with a master branch on a completely new repo for the first time in a while. It was actually kinda a weird experience.

    • NuXCOM_90Percent@lemmy.zip
      link
      fedilink
      arrow-up
      22
      ·
      edit-2
      4 days ago
      git checkout -b main
      git branch -D master
      git config --global init.defaultBranch main
      

      You don’t have to deal with shit if you don’t want to.

    • dohpaz42@lemmy.world
      link
      fedilink
      English
      arrow-up
      8
      ·
      4 days ago

      If you haven’t already found it, you need to change your global git config (~/.gitconfig):

      git config --global init.defaultBranch main

      (or whatever you want to call it; e.g. daddy would work too)

      For any existing repositories you want to run the following command in the existing repository root (./.git/config):

      git config set init.defaultBranch main

    • pageflight@lemmy.world
      link
      fedilink
      English
      arrow-up
      2
      ·
      4 days ago

      Yeah, current company has their internal git server default to master and it was a little odd first time I created a new repo. Luckily all the CI templates can recognize either name so I just switched it.