Vlad Preda
Vlad Preda

Reputation: 9920

Remove files from remote repo only

I did kind of a bad thing on my branch, and now it's a bit messed up.

I am developing a magento extension, and I accidentally commited some core files, and some folders similar to .idea to github.

What I want to do now is to remove these files from git, and keep them on my local branch. I tried the following (but didn't work):

git rm -rf --cache .idea
git add -A
git commit -m "remove unnecessary files"
git push origin blog

But it had no effect.

PS: In the meantime, I did a lot of useful commits, so reverting would be ... unpleasant :)

Thank you

Upvotes: 2

Views: 471

Answers (2)

wRAR
wRAR

Reputation: 25559

Your git add -A command added back all files you unstaged. If you always checked the diff before committing you would notice this.

Upvotes: 2

Gung Foo
Gung Foo

Reputation: 13568

removing the files seems to already have been answered here: Completely remove files from Git repo and remote on GitHub

to prevent those files from being uploaded again while keeping them locally push a different branch to git that doesn't contain your secret files. :)

Upvotes: 2

Related Questions