[英]unable to move files from unstage with git
我正在尝试取消暂存两个文件。 当我输入git status时,我的消息是:
On branch master
Your branch is up-to-date with 'origin/master'.
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
modified: public/javascripts/app.js
new file: views/templates/caffeineTable.html
我使用了git reset HEAD和该文件来取消登台,如命令行所示。 但是,当我按照说明进行操作时,我又回到了我在分支主机上的经历
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: public/javascripts/app.js
我遵循了第一步,并添加了用于更新的文件。 但是,当我执行git status时。 我又回到了相同的起始位置。
我通读了git https://git-scm.com/book/en/v2/Git-Basics-Undoing-Things上的文档,但不确定是否需要git checkout。
目标是使所有内容保持最新,并且暂不进行任何分阶段。
您需要一些有关git的基本概念。 当您处于第二步时:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: public/javascripts/app.js
git告诉您,与上一个版本相比, app.js
文件已更改。 您的文件(可能是最新),但是还有一些其他更改。 您可以使用
git diff
以显示与HEAD版本(=历史记录中的最后一个版本)的区别。 现在,git为您提供了两种选择:
git add
:您要分阶段进行这些更改; 这意味着准备这些更改以提交它们并将其保留在历史记录中。 git checkout
:您要放弃这些更改; 这无法撤消 ; 您的文件将替换为该文件的HEAD版本。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.