我想正确使用git但出现一些问题。在GitStatus上,显示的文件已修改。
modified: dev/tests/acceptance/.gitignore
modified: dev/tests/acceptance/.htaccess.sample
modified: dev/tests/acceptance/tests/_bootstrap.php
modified: dev/tests/acceptance/tests/_data/lorem_ipsum.txt
modified: dev/tests/acceptance/tests/_suite/WYSIWYGDisabledSuite.xml
modified: dev/tests/acceptance/tests/_suite/suite.xml.sample
modified: dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProductCatalogSearch/LICENSE.txt
modified: dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProductCatalogSearch/LICENSE_AFL.txt
modified: dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProductCatalogSearch/README.md
modified: dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProductCatalogSearch/Test/EndToEndB2CGuestUserTest.xml
modified: dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProductCatalogSearch/Test/EndToEndB2CLoggedInUserTest.xml
modified: dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProductWishlist/ActionGroup/StorefrontCustomerWishlistActionGroup.xml
modified: dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProductWishlist/LICENSE.txt
modified: dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProductWishlist/LICENSE_AFL.txt
modified: dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProductWishlist/README.md
modified: dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProductWishlist/Test/EndToEndB2CLoggedInUserTest.xml
modified: dev/tests/api-functional/.gitignore
这是我的忽略文件:
/dev/*
/dev/test/*
我已经研究了许多文章,但我找不到解决方法。 参考文章:gitignore does not ignore folder
我尝试执行以下命令:git rm -r --cached
。现在,此文件显示以下文件已删除。因此,当我运行git add.
和git push origin master
时,是否从母版中删除?
答案 0 :(得分:0)
删除后不要运行git add
。只需提交git rm
命令,它将从index
中删除它。如果您在提交之前运行git add
,它将把分阶段执行的删除操作重新添加到index
中。
运行以下命令从index
中删除文件并维护本地文件。
git rm --cached -r dev/tests
git commit -m "Removed dev tests"
git push origin master
在项目的根目录下,确保您拥有一个.gitignore
,其中包含以下内容
dev/tests/*