We have a git repository since 8/13/2013, with over 4000 commits, occupying almost 7 GB of disk space. (GIT Version: 2.9.0.windows.1)
During these years the project evolved pretty much, so the oldest commits are no longer useful.
As many other, we'd like to "consolidate" the history from a certain date. Let's say we want to "squash" together anything older than 6 months, to become a single big commit.
The main handicap is that we got a multi-branches structure, and obviously we want to preserve it:
- Master branch (perpetual)
- Develop branch (perpetual)
- Feature branches (one for each task, deleted after merging)
In example, This is how the history looks now:
This is what we need:
We tried several approaches such "Rebase", "Cherry pick", "clone" with "depth"... but nothing seems capable to do what we need. These are the most meaningful things I tried:
Rebase and Cherry pick (using tortoiseGit 2.1.0.0) With both commands I tried to "squash" the oldest commits, but each merge results in a dialogue "which parent do you want to pick? parent1/parent2", then no matter which I pick: all files get marked as "conflict" and so they need to be resolved "manually". I just can't handle all this conflicts manually (nor reproduce the same identical sequence for Master and Develop branches).
Clone with depth (via Git-Bash) I executed this command: "git clone limitedRepo --depth=1000" that correctly "squash" all older commits, but the resulting repo has only a single branch.
So I tried this command to get back Develop branch from origin:
"git remote set-branches origin '*'" "git fetch -vvv"
but the fetched branch contains the whole history, not the "squashed" we need.
I tried to use the same commands with different parameters, but I'm just groping.
Any idea?