{"thread":{"id":"41921","subject":"git mv - exclude source / create target directory option","startedAt":"2016-04-04T06:45:06Z","lastAt":"2016-04-04T06:45:06Z","messageCount":1,"participants":["Boettger, Heiko"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"282602","messageId":"8C0042D8869AEA4AA334B49AFBBCEF82B53D470F@TUT-EX02-PV.KSTG.corp","threadId":"41921","inReplyTo":null,"subject":"git mv - exclude source / create target directory option","fromName":"Boettger, Heiko","fromEmail":"heiko.boettger@karlstorz.com","sentAt":"2016-04-04T06:45:06Z","receivedAt":"2016-04-04T06:45:06Z","isPatch":false,"sender":{"key":"heiko.boettger@karlstorz.com","avatar":null},"body":"Hi,\n\nsometimes I want to reorganize the content of a directory and simply move everything into a subdirectory. This seems to be more complicated than it should be. Since git mv requires the destination to exist, I need to create the target directory first. Unfortunately this results in git mv * to include that directory which results in an error since moving a directory into itself is not possible. My current workaround is rather long by using extglob:\n\nmkdir -p newfolder/subfolder\nshopt -s extglob\ngit mv !(newfolder) newfolder/subfolder\nshopt -u extglob\n\nFor my usecase it would be much easier to archive that target by have a parameter to simply create the target if it isn't existing.\n\nBest Regards\nHeiko Böttger\n\nSTORZ Endoskop Produktions GmbH\nNiederlassung Schaffhausen\nSchneckenackerstr. 1\n8200 Schaffhausen\nSwitzerland\n"}]}