简体   繁体   中英

Creating sub-repository from a main repository Git

We have a large solution (about 1.5gb) in size on Bitbucket, in which resx files sit in 3 seperate folders. From this repository I would like to be able to push all of the resx files in to another repository (ie translation repository).

This is so translators can work on these files seperately (in isolation) and then merge them back in to the original repository.

My initial idea was to create the second repository with a .gitignore , as per answer here , that ignores everything but the resx files.

# Ignore everything
*

# Don't ignore directories, so we can recurse into them
!*/

# Don't ignore .gitignore
!.gitignore

# Now exclude our type
!*.resx

We could then use (as per answer here ) to mege files between them?

$: git remote add local ../AnotherRepo
$: git fetch local
$: git merge local/master

However, I assume that this would see the two repositories as two sperate file structures with their own seperate histories etc?

Is there a more efficient way I can use git to achieve the above and keep the two repositories in sync and merge between them? Ideally use the translation repository as a sub repository of the main repository?

I wrote this up in an earlier answer which should make things clear, but Git has support for submodules , which should be a possible solution.

Basically you can add one repository as a submodule of another. Each repository is completely separate, but one can include others. You can then clone the parent repository using the --recursive flag to include the submodules. That way you can keep components separate if it's logical to do so.

In your case what you'd probably want to do is have one or more separate repositories for the translations and set them up as submodules of your application.

The Pro Git book is a good place to look for more information on submodules.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM