0

How to merge two git repositories into one? I have got a parent folder say 'P' and two subfolders 'A' which has 5 commits and 'B' which has 5 commits. I want the repos in A and B to disappear and combine as one with 10 commits,this new repository must be placed in the parent directory 'P'.

Vishal
  • 59
  • 1
  • 8
  • 1
    Possible duplicate of [How do you merge two Git repositories?](http://stackoverflow.com/questions/1425892/how-do-you-merge-two-git-repositories) – sashoalm Apr 29 '17 at 14:24

1 Answers1

1

The basic idea is to merge two repositories are as follows

Create a new empty repository New. Make an initial commit because we need one before we do a merge. Add a remote to old repository old A. Merge old A/master to New/master. Make a sub directory old A. Move all files into sub directory old A. Commit all of the file moves. Repeat 3-6 for old B.