How does GIT merge files from another remote Git repository to a specified subfolder in the local repository without losing remote commit records?

Source: Internet
Author: User

Issue background:recently in the reorganization of the hands of a project, currently the project is divided into PC projects, mobile projects, a third-party interface projects, third-party interface services projects and mobile projectsbecause of the previous planning reasons, the original four projects are managed by two solutionsPC Solutions:
#PC解决方案, 2015 total three projects migrated from VSS to git #f:\www\f.com\wwwflight.slnflight.suoweb #PC项目Qr #第三方接口项目 2015 New project, Also uses a PC solution but manages with branches, maintains separate generic projects, and now separates common projects into separate branches for individual maintenance (add only DLLs to be referenced) Qunartts #第三方接口服务项目2015年新增项目, but also with a PC solution but branch management , maintaining a separate common project, and currently separating the common project into separate branches for individual maintenance (add only DLLs to be referenced) #所有通用项目, only pc& Mobile & third-party projects provide unified support Bllmodelcommon WebHelp Sqlserverdaldbutilitylanguagesflightapi #机票ApiMobile #手机项目 need to be merged from another solution.

  

 Mobile Solutions:
#手机解决方案, all DLLs refer to the PC generic project dll# because at that time the phone and PC view and most of the features are different, so a single solution to do #f:\www\f.com\mobilewebappwebapp.csproj # Mobile Project WebApp.sln #解决方案WebApp. suo

  

As a result of the recent adjustment of customer's business, so involved in the above four all projects, in the processing of the following problems occurred
    1. Because the PC, the third-party interface, and the interface services all co-maintained the common project, so I frequently in these three projects before switching merge (save the common project file consistent) has been resolved
    2. Mobile phone solutions Like other projects, use DLLs of the same generic project but not separately, why separate a solution and decide to merge into a PC solution to manage in a branched way
so I began to try to solve the above problems
    1. Separate all common items such as PCs, third-party interfaces, and interface services from three branches to a single branch. Unified management
      Other items if you want to change the generic file you must switch to the branch and then generate and then switch back to add a new DLL (to ensure common project file consistency)
    2. Incorporate projects from your mobile solution into your PC solution and then maintain them with the new branch mobile
Problem 1 has been resolved, when I was inThis problem is encountered when merging mobile solution projects into a PC solution:How does GIT merge files from another remote Git repository to a specified subfolder in the local repository without losing remote commit records?  when I get the information "Git pull remote-address" for remote Git, the mobile project file is in the root directory of the PC repository "F:\WWW\F.COM\WWW"And I want the mobile project file to be in the mobile directory under the root directory."F:\WWW\F.COM\WWW\Mobile"After I repeatedly test and use other command fetch, etc. are not resolved, and then put their own problems in the group, after communicating with the group of n hours did not solve my problem, but a group of friends said you can use the subtree sub-directory of the way to try to find all kinds of information on the Internet to do various tests, Finally after two days to complete the problem solvingthe merge must meet the following criteria:1.must be complete.Merge all files from the remote Repository (mobile project) and submit to the Repository (PC project)2. All remote files must be in the directory specified locally"F:\WWW\F.COM\WWW\Mobile"Instead of the root directory in the local repository3. Only one Git repository after merging (merge remote commits to local commit)"F:\WWW\F.COM\WWW\.git"The following is the real test information: Thanks to the group of friends and online information! Reference:
Use Git-subtree to introduce external projects as subdirectories
git submodule VS git subtree
Git subtree Command anatomy
Use git subtree to split subdirectories into separate new repo git subtree Do you want to use the –squash parameter git subtree merge and subtree split merge both Gi T repositories without breaking file
history



From for notes (Wiz)



How does GIT merge files from another remote Git repository to a specified subfolder in the local repository without losing remote commit records?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.