Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cross-project-issues-dev] How to merge (subsets of) 2 git repos into 1, preserving history ?

On 04/09/2015 11:14 AM, Oberhuber, Martin wrote:

Hi all,

Hi, 

1.       Create a new git repo under /gitroot/tm/org.eclipse.tm.terminal.git

2.       Fill it with the following subtrees from 2 other git repos, including all history in those subtrees respectively:

a.       http://git.eclipse.org/c/tm/org.eclipse.tm.git/tree/terminal

b.      http://git.eclipse.org/c/tcf/org.eclipse.tcf.git/tree/terminals

Unfortunately, those repositories seem to have colliding content (pom.xml, .project... filed under the same relative location). This will require actual conflict resolution.
Do you also need to keep all branches/tags, or just merging master branches with history is enough?
If the later:
  $ cd org.eclipse.tm.terminal/
  $ git remote add tcf git://git.eclipse.org/gitroot/tcf/org.eclipse.tcf.git
  $ git remote add tm git://git.eclipse.org/gitroot/tm/org.eclipse.tm.git
  $ git fetch tcf master
  $ git merge FETCH_HEAD
  $ git fetch tm master
  $ git merge FETCH_HEAD
// Have fun with actual merging of files, that's where most of the work is. Apparently, there are "only" 8 files to merge, some of them being trivial, so it may be only 1 hour of work.
  $ git add admin/target-defs/*.target admin/* .gitignore
  $ git commit -m "Merge TM and TCF"
  $ git push origin HEAD:master

HTH
--
Mickael Istria
Eclipse developer at JBoss, by Red Hat
My blog - My Tweets

Back to the top