news.volyx.in

New in Git: switch and restore (banterly.net)

872 points by todsacerdoti · 1880 days ago · 543 comments on HN

Article summary

The article discusses two new Git commands, `git switch` and `git restore`, which were introduced in version 2.23 to replace the overloaded `git checkout` command. `git switch` is used to switch between branches or commits, while `git restore` is used to restore the state of a file to a specified Git revision. These new commands aim to make Git more intuitive and easier to use, especially for newcomers. The article encourages users to start using these new commands to make Git less confusing.

Main themes

  • Git commands
  • New features
  • User experience
  • Command-line interface
  • Version control
  • Best practices

What commenters say

  • The new `git switch` and `git restore` commands are an improvement over the old `git checkout` command, making Git more intuitive and easier to use.
  • Some users are hesitant to switch to the new commands because they are already familiar with the old ones and see no incentive to change.
  • The new commands do not bring any new functionality, but rather simplify the existing functionality, making it easier to avoid mistakes.
  • Some users have already started using the new commands and find them to be an improvement, while others still use the old commands in scripts for compatibility reasons.
  • The use of `--` in Git commands is sometimes necessary to disambiguate between branch and file names, but can be optional in some cases.
  • The complexity of Git can be overwhelming, and some users recommend using a more complex architecture to manage multiple branches and tags.