title: Copy several folders and files from a git repository to another while preserving history
body: <p>I have a repo on github/bitbucket called X, here's the directory structure</p>
  
  <p><code>
      ├── folder1
      ├── folder2
      ├── folder3
      ├── folder4
      │   ├── a.cpp
      │   └── b.cpp
      ├── c.cpp
      └── d.cpp
  </code></p>
  
  <p>I want to make a new repo called Y, which should have </p>
  
  <p><code>
      ├── folder1
      ├── folder4
      │   └── a.cpp
      └── c.cpp
  </code></p>
  
  <p>The commit history of all the files should be preserved, and also the directory structure of X to be intact, how can I do this? </p>
  
  <p>Also if the above is possible, I don't want to move these files out of X because they are required by other files in X but want to work on them in repo Y and then push those changes to X somehow. I don't want change the directory structure of X or make the copied folders as submodules either. How can I make changes in the copied files and folders in Y and push those changes to a desired branch in X?</p>