Skip to content
DevMeme
4896 of 7590
VersionControl Post #5358 · source on Telegram

Git Checkout: The Command for Everything, Apparently

Description

A five-panel meme using the 'Believe it or not, jail' format from the TV show Parks and Recreation, featuring actor Fred Armisen in a military-style uniform. Each panel presents a different task in Git, and the answer is always 'git checkout'. The tasks are: 'Want to make a branch?', 'Want to switch branches?', 'Want to get a *specific* file version?', and 'Want to remove changes to one file?'. The final panel concludes with the punchline, 'Believe it or not, also git checkout'. This meme humorously critiques the overloaded and often confusing nature of the `git checkout` command, which historically handled many unrelated operations, from navigation to creating new branches to destructive file restorations. This ambiguity was a common pain point for developers, which led to the creation of the more explicit `git switch` and `git restore` commands in later versions of Git

Comments

14
Anonymous ★ Top Pick `git checkout` is the original 'function that does three things and two of them are destructive.' The introduction of `switch` and `restore` was Git's first-ever pull request that actually reduced complexity
  1. Anonymous ★ Top Pick

    `git checkout` is the original 'function that does three things and two of them are destructive.' The introduction of `switch` and `restore` was Git's first-ever pull request that actually reduced complexity

  2. Anonymous

    git checkout is the CLI’s legacy monolith - does everything, terrifies new hires, and no matter how many ‘git switch’ or ‘git restore’ microservices we spin up, prod traffic still tunnels through the big ball of mud

  3. Anonymous

    The real reason Git 2.23 introduced 'git switch' and 'git restore' was to prevent senior engineers from having existential crises explaining to juniors why one command does seventeen different things depending on whether you use -b, --, or just pray to the Git gods correctly

  4. Anonymous

    This perfectly captures why Git finally introduced 'git switch' and 'git restore' in 2019 - because having one command handle branch creation, branch switching, file restoration, and detached HEAD states was the kind of API design that made even Linus question his life choices. It's the command-line equivalent of using a single HTTP endpoint for GET, POST, PUT, and DELETE based on moon phase

  5. Anonymous

    Git checkout: the monolith command ruling branches and restores - until we microserviced it into switch and restore for that sweet separation of concerns

  6. Anonymous

    Git 2.23 split checkout into switch/restore to remove the footguns, but my hands still type `git co -b` and speedrun a detached HEAD faster than our CI warms the cache

  7. Anonymous

    git checkout is the CLI monolith that violates SRP - branching, switching, restoring, and occasionally deleting your afternoon; Git shipped “switch” and “restore,” my fingers shipped “checkout -b” and a detached HEAD

  8. Алексей 3y

    Explain please 😁

    1. @RiedleroD 3y

      git checkout -B branch git checkout branch git checkout <version> ./path/to/file git checkout HEAD -f

    2. @azizhakberdiev 3y

      every commit has own unique ID (we usually see first 6 characters, like "6aed21f"), basically, git checkout just moves you to a specific commit

  9. @SomeWhereIBelong 3y

    Git is literally the hardest thing i have to deal with as C++ programmer

  10. @deerspangle 3y

    Is this why they're bringing in git switch?

    1. @StephenTo 3y

      Yep. Git switch for dealing with branches and git restore for dealing with file versions. Git checkout is technically deprecated because it can do so much (but it probably will never be removed).

  11. @Vlasoov 3y

    git checkout .

Use J and K for navigation