One git to bring them all, and in a repo bind them.

I had to reunite various git repos under a new one. To do this without losing logs, I found a stackoverflow hint that worked for me.

# add and get the old repo data
git remote add old_repo
git fetch old_repo

# merge into my master without commit…
git merge -s ours –no-commit old_repo/master

# …we need to relocate in the foo/ subdirectory before
git read-tree –prefix=foo/ -u rack_remote/master

# now… commit!
git commit -m “Imported foo as a subtree.”

The #git log presents files in the old place, so git log foo/ doesn’t work. We can instead
diff between various releases simply with

git diff rev1 rev2 —

Lascia un commento