Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-dev] Moving bundles with history from a Git repo to another

Hi all,

I've been asked a couple times how to migrate some folders (eg bundles) from a Git repository to another, and this preserving the history.
While I don't remember the exact details, here are the steps I've carried on:

* from the *source* Git repo
  ** Make sure you're on latest master
  ** use "git filter-repo" (from https://github.com/newren/git-filter-repo/ ) to just keep the subpart of the repository you need, basically passing the directories you want to keep
  ** check the content of the repo on the filesyste,
  ** check `git history` for a long time, to ensure that history seems to contain relevant things only and that the history seems complete (basically the 1st commit of legacy history is still visible -with a different hash though- in the filtered history)
   ** `git push myFork HEAD:refs/heads/filtered-repo`
* From the *target* repo
   ** Make sure you're on latest master
   ** add your local fork of source repo as remote `git remote add myForkOfSourceRepo git://github.com/me/sourceRepo`
   ** `git fetch myForkOfSourceRepo filtered-repo`
   ** `git merge --allow-unrelated-history FETCH_HEAD` (leave default merge commit and message)
   ** Fix various pom.xml, bump versions.,, as needed until local build work
   ** `git add ` changes then `git commit -m "Adapt releng for move of X, Y, Z from sourceRepo`
   ** Push to your fork
   ** Create a PR
* From the source repo
   ** Get back to latest master
   ** Remove all moved content
   ** Adapt pom.xml and so on until build works
   ** Commit
   ** Create PRs
* On each of both PRs, add a link to the other one, as they will need to be merged at the same time
* Once PRs are merged, trigger an I-Build and hope for a successful build in the next 40 minutes; or fix.

HTH
--
Mickael Istria
Eclipse IDE developer, for Red Hat

Back to the top