0

I had a task which is about extracting a folder from a repo and create a repo with the history of the folder extracted. I've searched the internet and I found people talking about git subtree and I used it as follows : git subtree split -P <PATH_TO_FOLDER> -b BRANCH_NAME

After finishing the process, I found that the commits in the branch created less than the commits when I git log PATH_TO_FOLDER and I don't know why this happens.

Is there any way to do this without missing any commits?

Alaa Agwa
  • 162
  • 1
  • 12
  • You might find this useful: https://stackoverflow.com/questions/55522392/how-to-copy-specific-files-from-one-git-repo-to-another-preserving-history/55523006#55523006 – Mike Faber Apr 23 '19 at 18:11
  • `git log BRANCH_NAME..HEAD -- PATH_TO_FOLDER` should give you the commits that affect `PATH_TO_FOLDER` and are _not_ in `BRANCH_NAME` (the extracted history) but _are_ in your current branch; in other words, you should get the extra commits. What do you see? – Enrico Campidoglio Apr 24 '19 at 08:20
  • @MikeFaber Thank you for your response, but it will take forever to only move one folder from the original repo. – Alaa Agwa Apr 24 '19 at 11:14
  • @EnricoCampidoglio I tried this command but it gives me nothing. – Alaa Agwa Apr 24 '19 at 11:14

1 Answers1

0

I knew what was wrong.

There was a branch that's not merged into the master branch -which causes some commits to be missing after executing git subtree-, and after many trials I found that git subtree is working on a single branch not the whole repository so I merged the last branch to the master branch and executing it again and it worked.

Alaa Agwa
  • 162
  • 1
  • 12