Discuss / Git / 在git status没有看到提示命令git checkout -- <file>,而是git restore <file>

在git status没有看到提示命令git checkout -- <file>,而是git restore <file>

Topic source

Aubrey·Chen

#1 Created at ... [Delete] [Delete and Lock User]

在git status没有看到提示命令git checkout -- <file>,而是git restore <file>,那到底用哪个撤销的?是不是Git最新版的才改成这个命令的?

JelarSuperman

#2 Created at ... [Delete] [Delete and Lock User]

Git社区发布了Git的新版本2.23。在该版本中,有一个特性非常引人瞩目,就是新版本的Git引入了两个新命令 git switch 和 git restore,用以替代现在的 git checkout。

git checkout 这个命令承担了太多职责,既被用来切换分支,又被用来恢复工作区文件,对用户造成了很大的认知负担。

ctzlwzg

#3 Created at ... [Delete] [Delete and Lock User]

确实提示中显示use "git restore <file>..." to discard changes in working directory   用于撤销


  • 1

Reply