1

I have tried every syntax I can think of but nothing has worked.

My repo all my files are in Files\MyFiles and I want to move them into the root of the repo.

The only command that has actually done anything without an error is

git mv ./Files/MyFiles/ ./

However all this did was move the MyFiles folder up one level. What I wanted to do was remove both of these folders so just the contents of MyFiles was in the root of the repo.

I have tried all kinds of stuff, adding wildcards, dots, changing the folder I'm in etc. but nothing has worked, I always get some variation of an error.

Is there a way to use this command correctly?

e.g.

C:\git\MyRepo [master ≡]> git mv ./Files/MyFiles/* ./ 
fatal: bad source, source=Files/MyFiles/*, destination=*
NibblyPig
  • 51,118
  • 72
  • 200
  • 356
  • Not an answer to `Is there a way to use this command correctly?` but speaks something against simply doing it in the file browser? Anyway have a look at [this answer](https://stackoverflow.com/a/21581211/7111561): you can use the `-k` option to also move so far untracked files. – derHugo Dec 14 '18 at 17:50
  • 1
    Possible duplicate of [How can I move all git content one-level up in the folder hierarchy?](https://stackoverflow.com/questions/7130850/how-can-i-move-all-git-content-one-level-up-in-the-folder-hierarchy) – derHugo Dec 14 '18 at 17:50
  • 1
    Also note [this](https://stackoverflow.com/a/47872966/7111561) and [this answer](https://stackoverflow.com/a/22287013/7111561) both are addressing the windows command line in specific. – derHugo Dec 14 '18 at 18:01

1 Answers1

0

Go to child folder and run for /f %f in ('dir /b') do git mv %f ../ , it will move files from child folder parent folder

arupjbasu
  • 351
  • 3
  • 4