0

I have a git repository and many branches.

master
build-app
develop
refactor-states

In branch build-app, I used to commit a folder release in repository and then deleted it.

But you know, it kept that folder forever. It make my repository so weighty ( about 200 MB).

I found the revision that had folder release: 170b737

So, can anyone could help me delete permanently folder release. I tried a few ways, filer-branch, git rebase but I could not delete it. Please help me!!!

nguyen nani
  • 125
  • 7
  • What `git filter-branch` did you try and what errors did you get? – ElpieKay Jun 04 '18 at 04:58
  • Possible duplicate of [How to remove/delete a large file from commit history in Git repository?](https://stackoverflow.com/questions/2100907/how-to-remove-delete-a-large-file-from-commit-history-in-git-repository) – phd Jun 04 '18 at 05:37
  • thanks @phd I solved the problem. I used git filter-branch and it worked – nguyen nani Jun 05 '18 at 02:23

1 Answers1

0

As per the specifications shared using git rm will be would you need:

git rm -r folder-release
git commit -m "remove folder release"

The above command will delete the folder from system, so if you want to remove it from git only use the below mentioned command:

git rm -r --cached folder release
git commit -m "remove folder release"

And to push changes to remote repo

git push origin build-app  

This is the procedure I used to delete a folder from remote repo using git.

Rohan
  • 2,681
  • 1
  • 12
  • 18
  • I solved mine problem In your solution, it just delete folder in your revision. But when you find all revision of git history, it still has folder release. – nguyen nani Jun 05 '18 at 02:25
  • Yes, from the above solution the folder will be removed in the last commit of git, in the earlier versions it will be showing that folder was committed. – Rohan Jun 05 '18 at 05:03