4 ms·
"git checkout" is a deprecated command, use "git switch" to switch to a commit, and "git restore" to restore a file
by Viliam1234 3y ago
"git checkout" is a deprecated command, use "git switch" to switch to a commit, and "git restore" to restore a file
- voidfunc 3y agoTell that to Google and all the top results for switching to a commit which everyone usually phrases as "git howto checkout commit"
- chipotle_coyote 3y agoAs of the current git release (v2.41.0), there is nothing in the documentation for "checkout" indicating it is deprecated, while the documentation for "switch" contains the phrase -- in all caps, like this -- "THIS COMMAND IS EXPERIMENTAL. THE BEHAVIOR MAY CHANGE." One presumes checkout will eventually be deprecated by switch, but it isn't yet.
- DanielVZ 3y agoI guess that warning is to prevent people from using it on a script because it’s not a stable command. But for normal shell usage, it’s the preferred method.
- yCombLinks 3y agoPreferred how? I get a warning when I use checkout? Who is teaching me it's preferred? Am I expected to keep up with a community newsletter to use my version control tools?
- pwdisswordfishc 3y agoPreferred by whom?
- askvictor 3y agoWhere is one supposed to learn this sort of thing? If the cli doesn't tell you when you use it, there's no way a lot of people will discover this.