"git mv *" returns "bad source" in Powershell

As has been pointed out by others in this thread, the star does not automatically expand to file names in PowerShell. Thus, the command let get-childItem needs to be used, which explicitely tells PowerShell to expand wildcard characters.

You want to put the result of get-childItem * into parentheses so that they are expanded before the entire git mv command is executed:

git mv (get-childItem *) whatever

To save a few key strokes, you might want to use the alias gci for get-childItem:

git mv (gci *) whatever

As @PetSerAI said, the Windows command prompt and PowerShell will not expand the globing characters and it makes git mv fail.

Use a bash shell like MSYS instead.


Using PowerShell to move the content of source to whatever folder you can run this command:

Get-ChildItem .\source\ | ForEach-Object { git mv $_.FullName .\whatever\ }

Your directory structure would look like this before:

+--C:\code\Project\
|
+----+bootstrap.py
+----+requirements.txt
+----+.gitignore
+----+source
|
+---------+manage.py
+---------+modules
+---------+templates
+---------+static
+----+whatever
|
+---------+cool.py

And after running would look like this:

+--C:\code\Project\
|
+----+bootstrap.py
+----+requirements.txt
+----+.gitignore
+----+source
+----+whatever
|
+---------+cool.py
+---------+manage.py
+---------+modules
+---------+templates
+---------+static