Combining multiple git repositories in windows giv

2019-08-28 21:40发布

问题:

I tried to follow this question: Combining multiple git repositories to combine multiple repositories in Windows 10, but it gives me an error:

"sed" no se reconoce como un comando interno o externo, "sed" it is not recognized as an internal or external command,

and even without it doesn't work for me! This is the structure of a microservice (minimo1 &2) in Jhipster:

microsvc1test
  |- gateway
  |    |_.git
  |- jhipster-registry
  |    |_.git
  |-minimo1
  |    |_.git
  |-minimo2
  |    |_.git
  • I follow step 1 (great idea to have the zip file done)
  • I follow step 2A: and create the cd microsvc1test/gateway/gateway and move the content of microsvc1test/gateway to microsvc1test/gateway/gateway (the same for the others)

I do not really need to keep the story and this command does not work in windows.

$ git filter-branch --index-filter \
    'git ls-files -s | sed "s#\t#&code/#" |
     GIT_INDEX_FILE=$GIT_INDEX_FILE.new \
     git update-index --index-info &&
     mv $GIT_INDEX_FILE.new $GIT_INDEX_FILE' HEAD
  • So this is the new structure (Step 3):
microsvc1test
  |- gateway
  |    |_.git
  |    |-gateway
  |         |_(the code...)
  |- jhipster-registry
  |    |_.git
  |    |- jhipster-registry
  |         |_(the code...)
  |-minimo1
  |    |_.git
  |    |-minimo1
  |         |_(the code...)
  |-minimo2
  |    |_.git
  |    |-minimo2
  |         |_(the code...)

  • Then, I follow step 4:

cd microsvc1test git init

D:\...\Jhipster\microsvc1test>git pull gateway
D:\...\Jhipster\microsvc1test>git pull jhipster-registry
D:\...\Jhipster\microsvc1test>git pull minimo1
D:\...\Jhipster\microsvc1test>git pull minimo2

so I get several of this:

D:\BasuraTemporal\Jhipster\microsvc1test>git pull gateway
remote: Counting objects: 594, done.
remote: Compressing objects: 100% (564/564), done.
Receiving objects: 100% (594/594), 712.83 KiB | 0 bytes/s, done.
remote: Total 594 (delta 71), reused 0 (delta 0)R
Resolving deltas: 100% (71/71), done.
From gateway
 * branch            HEAD       -> FETCH_HEAD

Then, I create a new repository on GitHub, commit and push, but the gateway, jhipster-registry, minimo1 & minimo2 are empty.

回答1:

I would delete all the hidden .git directories and then create a new git repository with git init. Then all the same as a regular one. You will loose all the commits of each of the individual repositories, but it should work. Try it



标签: git jhipster