aaragon
aaragon

Reputation: 2400

remove files from remote repository

I created a git repository a while ago, and now I realize that I don't need many of the files in the original project. I looked at this site but it seems to me that using git filter-branch is not the right tool, also because I have to delete many files and it doesn't make sense to use the command outlined there for files and directories. I guess what I would like to do is to have the repository in my computer be the new remote repository. So is there a way to replace the remote repository entirely by the one in my computer?

Upvotes: 2

Views: 305

Answers (1)

Anshul Goyal
Anshul Goyal

Reputation: 76887

You will need to run a git push --force origin master from your new local repo.

This will force update all the refs for master branch to those of your local repo. Note that this will not update any other branch, and will affect master only.

In case you want to delete all the other branches from the old repo as well, you can

  • manually delete each one of them using git push origin :branch_name
  • or delete the repo from github, create a new repo with the same name and now push your changes to this new repo.

Upvotes: 1

Related Questions