2

I have one directory 'Checkout' that needs to move to the directory 'screens'. I do not want to overwrite the screens folder, I just want to add Checkout to it. This is all on local machine.

So far I have created and navigated to a new branch. The idea is to move the entire directory in this branch, add/commit the changes then push this branch with the changed directory location to remote.

I have tried this command...

git mv app/Checkout ... app/screens

but I get

fatal: bad source, source=..., destination=app/screens/...

What am I missing?

SwissCodeMen
  • 4,222
  • 8
  • 24
  • 34
Ronald
  • 508
  • 6
  • 24
  • 1
    Does source exist? Are you in the correct working directory? (verify with `ls app/Checkout`) – knittl Apr 28 '21 at 22:06
  • Note you can just move the files outside of Git. When you stage up all the adds and deletes, Git will detect them as moves before you commit. – TTT Apr 28 '21 at 22:09
  • Is there any good reasons for the three dots in your command? – Nico Haase Apr 30 '21 at 05:53

2 Answers2

6

The command you want is git mv app/Checkout app/screens. The triple dots in the docs indicate that you can provide multiple source arguments, not literal dots.

Calum Halpin
  • 1,945
  • 1
  • 10
  • 20
2

The error fatal: bad source ... usually indicates that after last commit there were some renames in the source directory and hence git mv can‘t find the expected file. Just git commit before execute git mv.

And why ? You can simple execute the git mv-command as follow:

git mv app/Checkout app/screens

Look at Git-docu

SwissCodeMen
  • 4,222
  • 8
  • 24
  • 34