git mv - exclude source / create target directory option

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

sometimes 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:

mkdir -p newfolder/subfolder
shopt -s extglob
git mv !(newfolder) newfolder/subfolder
shopt -u extglob

For 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.

Best Regards
Heiko Böttger

STORZ Endoskop Produktions GmbH
Niederlassung Schaffhausen
Schneckenackerstr. 1
8200 Schaffhausen
Switzerland

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]