I have about a hundred visual studio projects in the C: \ temp \ folder, one project is one folder:

C:\temp\TestApp01\ ... C:\temp\WcfTest01\ 

and so on.

And part of these projects, I decided to pour into a single repository c: \ git \ StudyProjects:

 C:\git\StudyProjects\TestApp01\ ... C:\git\StudyProjects\WcfTest01\ 

And not just to pour, but preferably with saving commits. It is not necessary for me that each of them be dated to a real commit date, they can be dated by today's date, it is critical for me that the infusion project keeps the number and order of commits, so that I can later look at filtering the commit history by folder .

How to do it? I really do not want to transfer the pens, I want to automate: I specified the name of the original project, indicated in which project I’d pour in. But in order to write such a script, you need to understand what commands you can do with it.

Has anyone encountered a similar problem?

  • 2
    Yeah, called subtree merging git-scm.com/book/en/v1/Git-Tools-Subtree-Merging - Nick Volynkin
  • 2
    There will be two trees (roots) of commits simply, then they will converge in a merge commit and further on a normal tree. - Nick Volynkin
  • 2
    @NickVolynkin, there is also in Russian , but neither there is described there or even the subtree script is mentioned , which you probably meant. - aleksandr barakin 2:55 pm
  • @alexanderbarakin yes, I meant it, thanks. - Nick Volynkin

1 answer 1

You can use the subtree script included in the “bundle” installed with the git program:

 $ git subtree add -P подкаталог url-хранилища ветка-в-нём 

after running this command:

  1. the specified branch will be received from the specified remote repository
  2. its commits will be merged with commits in the current branch of the current repository
  3. files / directories from this branch will be placed in the specified подкаталог

Detailed description: $ man git-subtree