1

Suppose I have a monorepo whose directory is named monorepo. In the multirepo, each project has its own directory. Also suppose I have another existing repository named project-a that I wish to place into the monorepo.

To place project-a into the existing multirepo, I did this (taken from this question):

# Prepare project-a.
cd ~/project-a/
mkdir project-a/
mv * project-a/
git add --all
git commit -am 'Move all files into a directory in preparation for conversion to monorepo'

# Place project-a into the monorepo.
cd ~/monorepo/
git remote add origin ~/project-a/
git fetch origin
git merge origin/master --allow-unrelated-histories
git remote rm origin

At this point, the history (i.e. the output of git log) of project-a has been merged seamlessly with the existing history in the monorepo. But how do I view the history of project-a only? i.e. How can I view the history of project-a as if it had not been merged into the monorepo?

I tried git log -- project-a/, but that only shows one commit (i.e. 'Move all files into a directory in preparation for conversion to monorepo'), whereas I had intended to see all the commits I made for the files in project-a.

Flux
  • 9,805
  • 5
  • 46
  • 92
  • I assume project-a was a preexisting git repo? Then I think you should have used `git mv` instead of `mv`. Then git would know that you moved the files not that they popped up just like that on the project. – eftshift0 Nov 20 '18 at 12:33
  • @eftshift0 Yes, `project-a` was a preexisting repository. Edited the question. – Flux Nov 20 '18 at 12:37
  • @eftshift0 I experimented with your suggestion (i.e. using `git mv` instead of `mv`). There's no difference either way. Same result. – Flux Nov 20 '18 at 12:43

0 Answers0