Question

So a friend worked on a bunch of code that he never versioned, and is handing it off to me. He initially gave me version A, even though he had a more recent version B available. I put A into a git repository (on say Visual Studio Team Services), and then made some commits, resulting in version C. Now he has put up version B in a git repository (on say Bitbucket). How can I compare versions C and B, and merge all diffs between (B,A) and (C,A) to get one final version D which has both his updates and mine? Keep in mind, the repos on Bitbucket and TFS (versions B and C respectively) have no common git commits, although they both come off the same base version A.

I can see a couple of ways of doing this, not sure of the cons of each though: 1) Add Bitbucket version B as an upstream to my TFS version C, and fetch upstream/master, then do a git diff. 2) Copy the files from version B into the directory that holds version C, and then commit them as if I changed the files manually. 3) Something else entirely, like rebase.

My understanding of git is very basic so please explain like I'm 5 (well, not really, but you know what I mean).

Note: It is ok to have all changes made from A to B in one commit in the final repo history, but would be nice to preserve the individual commits between A and C.

Also, from version A to version B, the friend has not maintained directory structure, he has moved all the contents to a sub-directory of the root. So if version A had file a.txt, version B has file TRUNK/a.txt.

Was it helpful?

Solution

Simply:

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top