通常我会使用我的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
我然后将其返回到控制台。是否有一种方法可以避免复制/粘贴?
git status
的输出(而注释确实不是用于这个的好地方)。 - larsks