Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/github/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Git 仅从远程repo删除文件_Git_Github - Fatal编程技术网

Git 仅从远程repo删除文件

Git 仅从远程repo删除文件,git,github,Git,Github,我在我的分行做了一件坏事,现在有点乱了 我正在开发一个magento扩展,我不小心将一些核心文件和一些类似.idea的文件夹提交给github 我现在想做的是从git中删除这些文件,并将它们保留在我的本地分支上。我尝试了以下方法,但没有成功: git rm -rf --cache .idea git add -A git commit -m "remove unnecessary files" git push origin blog 但没有效果 PS:同时,我做了很多有用的提交,所以恢复将是

我在我的分行做了一件坏事,现在有点乱了

我正在开发一个magento扩展,我不小心将一些核心文件和一些类似.idea的文件夹提交给github

我现在想做的是从git中删除这些文件,并将它们保留在我的本地分支上。我尝试了以下方法,但没有成功:

git rm -rf --cache .idea
git add -A
git commit -m "remove unnecessary files"
git push origin blog
但没有效果

PS:同时,我做了很多有用的提交,所以恢复将是。。。不愉快的:


谢谢

删除文件似乎已在此处得到答复:


要防止在本地保存这些文件的同时再次上载这些文件,请将不包含机密文件的其他分支推送到git:

删除文件似乎已经在这里得到了回答:


要防止在本地保存这些文件的同时再次上载这些文件,请将不包含机密文件的其他分支推送到git:

您的git add-一个命令添加回所有未老化的文件。如果您总是在提交之前检查差异,您会注意到这一点。

您的git add-一个命令将所有未老化的文件添加回。如果您总是在提交之前检查差异,您会注意到这一点。

啊,是的,这似乎是我的问题。回想起来,这是有道理的,但我做git添加是出于反射:啊,是的,这似乎是我的问题。回想起来,这是有道理的,但我做git添加是出于反射: