github - How do I switch a git(hub) repository to point one level up? -


i have project called foo. on machine, project resides subfolder of non-git folder called foo_container (i.e, in foo_container/foo). foo git folder, , have synced github, , made several changes.

later, added more content in other folders under foo_container (like foo_container\foo_docs), , want check in foo_container repo on. not want lose git history foo, , of course, ok changes of foo_container being recorded on.

what cleanest way this? here couple of options considered:

option #1:

cd /path/to/foo_container git init <rename repository on github foo foo_container> <some git-remote command - don't know should switch existing repo> 

option #2 (may work, suspect lose git history of foo directory)

delete old foo repo on github, create new repo called foo_container, git init in foo_container , git-remote add origin <...foo_container.git>

i not sure if either of these approaches work, , better do.

the first approach good, can declare foo submodule of foo_container.

but easiest to:

  • rename locally foo foo_container (so foo_container/foo_container)
  • git mv foo_container/foo_container's content under new folder 'foo' (foo_container/foo_container/foo)
  • copy foo_container\foo_docs in foo_container/foo_container/foo_docs: add, , commit , push
  • rename github foo repo foo_container
  • replace locally foo_container foo_container/foo_container.

Comments

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -