I started my website project with SVN last year, then months ago I had to change of repo server when creating a branch.
I was still not happy with the new server so I eventually got a VPS for myself and installed Git on it.
I realized that I wanted to merge my first svn repo with my branch to create a unique Git repo with my project while KEEPING ALL THE HISTORY of the two merged branches.
It was a bit tricky, because I hadn’t migrated my first repo when creating the branch on the second server, I had at this point two repo with two branches of a same project on two different servers, and I wanted an easy way to get back everything cleanly on my new Git Repo and not lose the versioning.
So here is how I did it.
I created a local Git repo for each of my two project directories, importing the versioning from SVN.
They were named vdating1 and vdating2
I just needed to merge them and keep the history.
cp -R vdating1 vdating-combined
git fetch ../vdating2 master:vdating2
git filter-branch --index-filter \
'git ls-files -s | \
sed "s-\t-&'"$SUBDIR_NAME"'/-" | \
GIT_INDEX_FILE=$GIT_INDEX_FILE.new git update-index --index-info && \
mv $GIT_INDEX_FILE.new $GIT_INDEX_FILE' "$BRANCH_NAME"
I had to resolve conflicts at this point between my two branches, then
git merge vdating2
git branch -d vdating2
That was it, my new vdating-combined directory has the whole versioning and I’ve been able to go on my project, exclusively from Git this time!