【问题标题】:Git: reset deleted file from indexGit:从索引中重置已删除的文件
【发布时间】:2014-06-18 10:54:46
【问题描述】:
  1. 创建 2 个文件:one.txttwo.txt
  2. 提交两个文件:git add -Agit commit -m "message"
  3. 编辑one.txt并将其添加到索引:git add one.txt
  4. 删除two.txt并将其添加到索引:git rm two.txt

我只想提交one.txt,因此我需要从索引中重置two.txt怎么做?

git commit one.txt 有效,但不适用,因为可能是 100 个文件而不是 one.txt

【问题讨论】:

标签: git git-reset git-index


【解决方案1】:

命令git reset HEAD two.txt 重置索引中的文件并且不要在工作目录中触摸它。你需要什么!

【讨论】:

    猜你喜欢
    • 2012-07-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-08-30
    • 2013-06-03
    • 2014-01-15
    • 2021-10-14
    • 1970-01-01
    相关资源
    最近更新 更多