LibreTechni.ca
  • Communities
  • Create Post
  • Create Community
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
cm0002@mander.xyz to Programmer Humor@programming.dev · 1 year ago

When you have to checkout the master branch

lemmy.world

message-square
41
fedilink
471

When you have to checkout the master branch

lemmy.world

cm0002@mander.xyz to Programmer Humor@programming.dev · 1 year ago
message-square
41
fedilink
  • Eager Eagle@lemmy.world
    link
    fedilink
    English
    arrow-up
    46
    ·
    1 year 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.

    • rhabarba@feddit.org
      link
      fedilink
      arrow-up
      14
      ·
      1 year ago

      Ah, I love coherent software.

      • sik0fewl@lemmy.ca
        link
        fedilink
        arrow-up
        13
        ·
        1 year ago

        Switch and restore came later because checkout was problematic.

        • nightlily@leminal.space
          link
          fedilink
          English
          arrow-up
          3
          ·
          edit-2
          1 year ago

          Has someone made a „Checkout considered harmful“ blog post yet or do we not do that anymore?

          • anomnom@sh.itjust.works
            link
            fedilink
            English
            arrow-up
            1
            ·
            1 year ago

            E we used to always stash before checkouts to try and find things in a branch

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

        Just alias stuff like that, make it coherent.

    • Scrollone@feddit.it
      link
      fedilink
      arrow-up
      1
      ·
      1 year ago

      I agree, I wonder why they decided to design it that way in the first place.

      • paperplane@lemmy.world
        link
        fedilink
        arrow-up
        1
        ·
        11 months ago

        In both cases, checkout updates your working tree (by checking out either all or just some files from a commit), just when you’re switching branches it moves your HEAD pointer too

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.

  • 69 users / day
  • 1.94K users / week
  • 6.76K users / month
  • 14.8K users / 6 months
  • 1 local subscriber
  • 34.3K subscribers
  • 1.8K Posts
  • 40.8K Comments
  • Modlog
  • mods:
  • adr1an@programming.dev
  • Feyter@programming.dev
  • BurningTurtle@programming.dev
  • Pierre-Yves Lapersonne@programming.dev
  • BE: 0.19.5
  • Modlog
  • Instances
  • Docs
  • Code
  • join-lemmy.org