How can I move all git content one-level up in the folder hierarchy?
Another variant of Sumeet's answer - in the repository directory above "webapp" execute following command:
git mv webapp/* ./ -k
-k - Skip move or rename actions which would lead to an error condition, otherwise you get:
fatal: not under version control, source=webapp/somefile, destination=somefile
The right way to do this is:
git mv repo.git/webapp/* repo.git/.
git rm repo.git/webapp
git add *
git commit -m "Folders moved out of webapp directory :-)"
I was able to get it to work simply by doing this from the destination folder:
git mv webapp/* .
In Windows shell the * will not work (fails with an error Bad source
), but it will work in Windows if you use the Git Bash shell, which expands the *
wildcard.
If you are using Powershell, you can also do:
git mv (gci webapp/*) .
or
git mv (get-childItem webapp/*) .