我经常使用我的 IDE 或通过命令行(而不是通过 git mv)在 git 存储库中移动文件。
结果,我最终在下一次提交时删除了几个未暂存的文件,如下所示:
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: test.html
#
# Changes not staged for commit:
# (use "git add/rm <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# deleted: css/bootstrap.css
# deleted: css/bootstrap.min.css
# deleted: img/glyphicons-halflings-white.png
# deleted: img/glyphicons-halflings.png
# deleted: js/bootstrap.js
# deleted: js/bootstrap.min.js
我通常会选择所有已删除的文件并在文本编辑器中编辑它们以生成如下内容:
git rm css/bootstrap.css
git rm css/bootstrap.min.css
git rm img/glyphicons-halflings-white.png
git rm img/glyphicons-halflings.png
git rm js/bootstrap.js
git rm js/bootstrap.min.js
然后我把它扔回控制台。
有没有办法做到这一点而不必复制/粘贴?