git - 仅添加修改过的已暂存文件

标签 git

如何重新添加已暂存但在暂存后修改的文件?我不想手动一一添加它们。

$ git status
On branch master
Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

 modified:   file1
 modified:   file2

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:   file1
 modified:   file3

这里我不想暂存 file3

最佳答案

结果 git update-index 有一个专门用于此目的的选项:

git update-index --again

Runs git update-index itself on the paths whose index entries are different from those from the HEAD commit.

来源:

关于git - 仅添加修改过的已暂存文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63729260/

相关文章:

xcode - 如何从 Git 存储库中删除 'excluded' 文件?

linux - 如何管理git用户?

Git 在日志中显示所有分支(但不存储)

git checkout my_branch 与 git checkout origin/my_branch

GitLab:我无法推​​送或克隆 repo 协议(protocol),要求提供 Git 密码

multithreading - 如何以多线程或高效方式执行 "git pull"?

git - Git SVN 忽略路径如何工作(忽略每日构建标签)?

git - VS 代码 Git : spawn EBADF

git - azure 网站,不断收到错误 : Could not connect to the Local Git repository

git - 通过 puppet 运行 ssh-agent