git/list[1] front-page[2] threads[3] people[4] search[5] about
 

git mv - exclude source / create target directory option

From
BHBoettger, Heiko <heiko.boettger@karlstorz.com>
Date
Apr 4, 2016, 06:45 UTC
Message-ID
<8C0042D8869AEA4AA334B49AFBBCEF82B53D470F@TUT-EX02-PV.KSTG.corp>
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

Message 1 of 1 in “git mv - exclude source / create target directory option”
  1. Boettger, HeikoApr 4, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.