roc*_*ves 3 git version-control
我开始注意到有时当我输入git status检查分支时会看到文本:
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: some_code_or_file.py
Run Code Online (Sandbox Code Playgroud)
有时我会看到:
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: some_code_or_file.py
Run Code Online (Sandbox Code Playgroud)
它开始让我害怕。这里发生了什么?
您几乎肯定会在两台不同的计算机上或在运行不同版本的两个不同二进制文件时看到这些消息。git restore 是在 2.23 中引入的,此后不久帮助消息发生了变化(我不记得确切是哪个版本,或者更改日志中没有提到它,或者我很密集并且找不到它)。
git restore <file>并git checkout -- <file>做同样的事情,所以除了好奇之外,没有必要担心差异。git checkout是一个混乱的命令,它可以做很多不同的事情——引入git switch并git restore试图使其对初学者更直观,而不改变功能。
| 归档时间: |
|
| 查看次数: |
48 次 |
| 最近记录: |