0

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...)

explorer

  • 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.

Mike
  • 1,059
  • 5
  • 28
  • 51
  • 1
    Assuming you're using Git for Windows, you need to use Git commands inside "Git Bash"... unless, in the installer, you selected the option to make everything work everywhere (the one where it explains that this can break other Windows tools). – Jan Krüger Mar 20 '19 at 11:32
  • Thanks, Jan. That explains why the command is not working and I can live with that, but what really annoys me is that I can not make the whole thing work. Are you saying that the step is mandatory (and otherwise is not going to work)? Or am I missing something else? – Mike Mar 20 '19 at 12:23
  • 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. – Jorge M. Nures Mar 22 '19 at 15:48
  • Yes, it works now. Thanks. It is like crazy – Mike Mar 22 '19 at 17:05

1 Answers1

0

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

Jorge M. Nures
  • 680
  • 1
  • 14
  • 30