stwalkerster
stwalkerster

Reputation: 1828

Move files in git from repo A to repo B/subdirectory without losing history

I have an assignment at university, and I have started developing for this in a git repository A. All the project's files are in the directory A/. However, I've just found out that as part of the hand-in process, we are requested to put the files in a repository B, under B/subdirectory/. At the moment, I don't have access to repository B - but the subdirectory has already been created by my lecturer.

What would be the best way to move the work I've already done to the subdirectory without destroying history?

Upvotes: 0

Views: 422

Answers (1)

manojlds
manojlds

Reputation: 301587

You need access to repository B so that you can clone it

Then you can do a subtree merge so that repository A, can be moved to B/subdirectory.

Look here for more on subtree merge : http://progit.org/book/ch6-7.html

The steps given in the link above as example can be used for your scenario and should be pretty straightforward.

Upvotes: 1

Related Questions