从git中删除已删除的文件
我从file1-->file2重命名了一个文件,git状态显示:从git中删除已删除的文件,git,version-control,Git,Version Control,我从file1-->file2重命名了一个文件,git状态显示: # On branch master # 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) # # del
# On branch master
# 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: pathname/file1.xml
您已准备好删除,现在使用
git commit
简短回答:使用git commit
提交更改
详细回答:看起来您已经提交了新文件。如果您想让git看到文件已移动,那么最好修改以前的提交。假设自提交新文件后未进行任何其他提交,可以使用以下命令执行此操作:
git commit --amend -C HEAD
提交并重新设置基础后,我得到了#未合并的路径:#(使用“git reset HEAD…”取消存储)#(使用“git add…”标记分辨率)#由我们添加:path/file1.xml#未添加任何更改以提交(使用“git add”和/或“git commit-a”)@Sammys再次尝试运行
git rm path/file1.xml
并执行另一次提交。为什么要在提交后重新设置基址?
# (use "git reset HEAD <file>..." to unstage)
# (use "git add <file>..." to mark resolution)
added by us: path/file1.xml
no changes added to commit (use "git add" and/or "git commit -a")
git commit --amend -C HEAD