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

Re: move git repository out of a folder?

From
Avery Pennarun <apenwarr@gmail.com>
Date
Jun 4, 2008, 20:08 UTC
Message-ID
<32541b130806041308y43a18b50s5dbca61f96a52823@mail.gmail.com>
In-Reply-To
<1086fb5f0806041303v7856404dxb95b5a450ac30ae1@mail.gmail.com>
On 6/4/08, Sean Brown <seanmichaelbrown@gmail.com> wrote:
Show 9 quoted lines
>  So now when colleagues clone my repository, they get the source code
>  in the "sourcecode" folder.  I'd like to just make the repository
>  simply give them the source files, not in a directory.  In other
>  words, as if I had originally been smart and done this:
>
>  cd /folderA/sourcecode
>  git init
>
>  Can I make that happen without losing all of the history?

You could just make a commit which renames all the files into the parent folder. This is relatively harmless and correctly reflects what really happened.

You might also want to look at git-filter-branch and its "--subdirectory-filter" option.

Have fun,
Avery
Previous: Sean Brown
Message 5 of 5 in “move git repository out of a folder?”
  1. Sean BrownJun 4, 2008
  2. Shawn O. PearceJun 4, 2008
  3. Jakub NarebskiJun 4, 2008
  4. Sean BrownJun 4, 2008
  5. Avery PennarunJun 4, 2008

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.