Time to be praised as “The Guru” in your office – or how to move a folder from one Git repo to another Git repo and preserve the history

Ok. This is the 5th or 6th time that I am doing this and one of my colleagues asked me.

Could you please write down how you do it so that we could do it without you next time.

So here it is. 2 minutes read and you can move files from one git repo to another repo and move the commit history for some of the files. Commands below, but first:

Word of caution (please):

Such an enormous power under your fingers would make you and object of great attention in your company. Colleagues will sing songs about you. You would be praised as “The Guru”. Small talks before meetings will start with “Have you heard of that dude that can move files to a new git repo and keep all the history”. (believe me, it is like walking on water). Also I can not promise, but I am pretty sure you can get laid with such knowledge. I once got laid for knowing JUnit and Eclipse so… who knows.

The disadvantage is that once people learn about you and your knowledge, you will be their go to person for questions about git. Git is quite complex and many people are lazy when it comes to reading documentation, so naturally many people would start asking you questions. Mostly stupid questions, of course. Can you handle the load?

Task

Moving folder integration/processors from old_repo repo to new_repo

Commands