Cyril Duchon-Doris
Cyril Duchon-Doris

Reputation: 13959

Git : produce clean repo by relocating big files

Ahhh I remember those days when I was a git newbie and I commited all those big library files along with my projects...

But now I'm trying to ressurect an old project like this, and I want to "purify" my repository stored on my school's server (and hell, it was hard to download those MB in one shot without the fetch failing in the middle !)

By "purify", I mean that I'd like to make an other repository from the existing one, if possible maintaining the "commits/branch" structure, but getting rid of some files/folders of my choosing.

In details, let's say I have this big folder /lib/ along with eventually some other ones, that I want to totally separate. But if possible, I'd like to have a clean, reversible separation : in every commit, I should keep some hash or whatever may give me a hint as to what the content of the /lib folder was.

The ideal solution would be to have two repositories that are always synchronized and with the "same commits"

In other words, what I'm trying to do is recreate artificially some kind of dependency manager (If only I had started a maven or so straight from the start.. sigh)

In a nutshell two steps :

Upvotes: 0

Views: 37

Answers (1)

Lol4t0
Lol4t0

Reputation: 12547

I believe you should apply interactive rebase approach.

You can mark commits that contain some library code with edit tag. While rebasing you will be able to drop that libarary code and change commit message to point your original commit code.

Upvotes: 1

Related Questions