新手到git工作流。
我已经开始从事一个开源项目。我把回购工具分叉了。
但是,当我将提交推到远程分叉时,.idea/目录将在GitHub上生成。Github回购。我的gitignore文件包含.idea/路径。
在这个./idea的帮助下,我删除了本地git存储库上的从Git存储库中删除文件。然而,当我推送到远程时,.idea/目录将保持不变。
发布于 2018-12-15 13:55:38
我的gitignore文件包含. .idea/路径。
一旦提交了文件,它就会开始被跟踪。所以它不足以将它添加到您的.gitignore中,您也必须将它从存储库中删除。
为了从这里删除文件,您必须从存储库中删除它们。
git rm --cached .idea/
此命令只从暂存中删除该文件,而不是从您的文件系统中删除,稍后添加到.gitignore中。
现在需要做的是删除整个.idea文件夹,提交删除,将想法扩展添加到.gitignore文件中。
# Remove the file from the repository
git rm --cached .idea/
# now update your gitignore file to ignore this folder
echo '.idea' >> .gitignore
# add the .gitignore file
git add .gitignore
git commit -m "Removed .idea files"
git push origin <branch>https://stackoverflow.com/questions/53792540
复制相似问题