9

Githubにプッシュしたくないフォルダーを無視したい場合は知っています。私は.gitignoreそれを無視するために使用することができます。

今の私の状況は、フォルダーをGithubにプッシュしたことです。これを無視して、Githubで削除したいのですが、それでもローカル側にフォルダーが必要です。

どうすればそれを達成できますか?

4

2 に答える 2

15

gitrm--cachedオプションがあなたが望むもののようです。

git rm --cached fileToDelete
git commit master
git push origin master
Now add the file to .gitignore

ただし、テストされていません。

于 2013-03-24T11:29:28.243 に答える
1

Githubからフォルダーまたはファイルを削除するが、コンピューターからは削除しないようにするには、次の順序でこのコマンドを使用します

  1. git rm -r --cached name-of-the-folder
  2. git commit -m "insert your comment inside this quotation marks"
  3. git push origin

あなたがいくつか持っている場合、あなたはbranchesすることができます

  • git push origin master
  • git push origin branchName

  1. git rm -r --cached .vscode
  2. git commit -m "removed the .vscode folder"
  3. git push origin
于 2020-08-17T09:24:19.180 に答える