简体   繁体   English

git如何删除不在目录中的所有文件,然后git add --all

[英]git how to remove all files which is not in directory and git add --all again

I just renamed a lot of files, eg myfile.php to Myfile.php . 我只是将许多文件(例如, myfile.php重命名为Myfile.php And realised that git ls-files shows old filenames. 并意识到git ls-files显示旧文件名。 So I run git add --all and git add , git commit and git push etc. Then I realised that there are old and new files in my git repo and git ls-files. 所以我运行git add --allgit addgit commitgit push等。然后我意识到git repo和git ls文件中有旧文件和新文件。

Is there any way I can remove all git files and add again? 有什么办法可以删除所有git文件并再次添加?

First run 首轮

git reset --soft

and then 接着

git diff

to see the files that have changed. 查看已更改的文件。

After that add the files you want to commit and do git commit -m 之后,添加您要提交的文件并执行git commit -m

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM