2

I'm trying to push my git repo to a heroku servers, now I used to have a big vendor folder, but I removed it using:

 git rm -r --cached vendor  

And I had no problem at that stage, anyways after I removed the files, and made the commit and everything, it seems that whenever I make push I still use the same files (even the files that I deleted), I'm pretty sure it is cached somehow, so how am I supposed to flush the cache? I tried so many stuff like updating the index but it's very weird since I'm still pushing 20 MB instead of 2 MB right now.

Any help would be highly appreciated.

3
  • 2
    It's really difficult to understand your situation. Have you actually committed the removal of those files in the branch you're pushing? (git show branch-name:vendor should inform you that the path doesn't exist) Are you worried about the size of the hosted repository? (You can't entirely remove those files and regain that space without rewriting history.) You also seem to be possibly confused about terms like "index" - you might benefit from reading the first parts of progit.org/book or book.git-scm.com, or maybe tom.preston-werner.com/2009/05/19/the-git-parable.html Commented Jan 14, 2012 at 2:26
  • "whenever I make push I still use the same files" <-- what do you mean? Also, remember that git rm -r --cached removes the files from the index, not the working tree Commented Jan 14, 2012 at 12:45
  • i'm totally confused here , but in master branch for example I just removed vendor dir , git show master:vendor shows path doesn't exist , but for some reason it seems that the files are still there ( at least the same size of the whole project still the same ) , how am I supposed just to remove the folder entirely, like even from the history and everything, I just want to make it simple when I push the code to heroku server instead of spending so much time , is that possible to do ? Commented Jan 14, 2012 at 15:13

1 Answer 1

4

>how am I supposed just to remove the folder entirely, like even from the history and everything?

This is where git filter-branch might come in handy. The following should do the trick.

$ git filter-branch --index-filter 'git rm --cached --ignore-unmatch vendor' --prune-empty -- --all

Note: Make sure to make a local copy of your project before playing with git filter-branch, especially if you try and reclaim some space (more about this in the linked references below).

Once your history is clean, the following will replace your upstream repository with the rewritten one.

$ git push origin --all --force

I'd strongly advise you to read the links below before running any command. Really :)

References

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.