How do I Re-root a git repo to a parent folder while preserving history?

前端 未结 8 1766
予麋鹿
予麋鹿 2020-11-29 23:12

I have a git repo in /foo/bar/baz with a large commit history and multiple branches.

I now want /foo/qux to be in the same repo as /f

8条回答
  •  再見小時候
    2020-11-29 23:21

    1 addition to the accepted answer, which helped me get it to work: when I put the listed text in a shell script, for some reason the -e was kept. (quite likely because I am too thick to work with shell scripts)

    when I removed the -e , and moved the quotes to encompass everything, it worked. SUBTREE2=echo "040000 tree $SUBTREE1 modules" | git mktree

    note that there is a tab between $SUBTREE1 and modules , which is the same \t that -e should interpret.

提交回复
热议问题