0

I have this structure in my git repo

  Proj1/Dir1

  proj1/Dir2

  proj1/ Dir3

I want to delete dir1 and dir2 from the repo also from all history.

How can I achieve that?

2
  • 1
    There's probably no good way to do that for a large or complex repo. One way might be to create a new master/base branch without those directories, then rebase your other branches against it. Commented Oct 2, 2014 at 18:52
  • Duplicate. Read the very bottom here kernel.org/pub/software/scm/git/docs/git-filter-branch.html Commented Oct 2, 2014 at 18:59

1 Answer 1

1

How about this?

git filter-branch --tree-filter 'rm -f -r --dry-run  Proj1/Dir1 proj1/Dir2' HEAD

remove the --dry-run part to do it for real.

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.