github - Git: move local project into other repo, keeping history -
i need somehow move existing maven project under version control git, inside git repo project resides.
why? in past few weeks, worked on project on own. use git locally (there no remote repository!) track changes. basic structure on side this:
myrepo |--.git |--myproject |--.gitignore
where myproject
maven project.
meanwhile, colleague of mine created repo himself, maven, project in it. repo remote, on github. structure looks this:
commonrepo |--.git |--hisproject |--.gitignore |--pom.xml |--.project |--.settings
so can see, idea there parent pom in repo specifies modules. hispoject
1 of these modules.
i want move myproject
there, maven module. don't want lose commit history in process. want final structure like:
commonrepo |--.git |--hisproject |--myproject |--.gitignore |--pom.xml |--.project |--.settings
i found approaches move 1 directory repo, seems none of these fit problem. looks solutions require myrepo
have remote , pull commonrepo
, merge.
so, how possible accomplish want?
assuming myrepo
, commonrepo
accessible same machine, following:
cd /path/to/commonrepo git remote add -f other_repo /path/to/myrepo git merge other_repo/master # following commands need executed if there conflicts. # description suggests conflict may in .gitignore. # run these commands after resolving conflicts manually. git add . git commit -m "merged myrepo" # end of commands needed in case of conflicts git remote remove other_repo
Comments
Post a Comment