我已经从现有的 Git 存储库创建了一个 Eclipse 项目。
它包含一些示例文档和代码,但我发现删除它们并从头开始更容易。
下次提交和推送时,存储库中的旧文档是否会毫无问题地删除?
最佳答案
请按照以下步骤操作:
NOTE : origin here refers to your remote project location.
第 1 步:从命令行导航到您工作的项目目录
第 2 步:在命令行中运行以下命令
git pull origin master /* Just to make sure you will get all the latest files from remote repository where you have hosted your project */
git rm * /* To remove all the files from you current directory */
OR
git rm file1.txt file2.txt /* to remote specific files */
git add . /* Add the deleted files for staging */
git commit -m "Removed obsolate files" /* Commit the deleted files into your local repository */
git push origin master /* Now push to the remote repository all the changes that you have done, all the deleted files will be now removed from remote repository */
第 3 步:现在您可以开始使用新文件
关于java - 将 Git 文件替换为新文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48804711/