I recently had to merge two git repositories in such a way that I preserved all the history.
<first_git> = first repository for merging, pulled from a remote master <second_git> = second repository to merge, pulled from a remote master <master_git> = new remote master to receive both histories # Add the new remote master to the repository >From within a local git clone of <first_git> git remote rename origin first_git git remote add master_git https://<master_git> git fetch master_git git merge master_git/master git status ## Edit, fix files, and test git commit git push master_git # Merge in from the second old remote git remote add second_git https://<second_git> git fetch second_git git merge second_git/master ## Edit, fix files, and test git commit git push master_git git branch --set-upstream master remotes/master_git/master You probably can't use exactly this recipe, but hopefully the steps help you follow how to get the job done. Richard On Monday July 29 2013 13:36:50 Nathan England <[email protected]> wrote: > > Hello! > > A consultant and I have been working on a code base together using github for > some time. We realized about a month ago that several files contained > extremely sensitive data and it was not wise to keep it on github. So I > deleted the github account and all the data with it. > > We now have to mildly differing code bases. > > I need to create a new git repository, which I have created on a server we > both have access to. Now the trick is to merge our two code bases and create > an initial commit. > > I would like your opinions or advice on the best way to merge these and > create > a new repo. I'm seriously new to git and not sure if I could just setup my > code and then create a new branch, delete everything in it and copy his data > in, then merge it to my master? How should I do this? > > Thanks! /* PLUG: http://plug.org, #utah on irc.freenode.net Unsubscribe: http://plug.org/mailman/options/plug Don't fear the penguin. */
