Git Merge a subdirectory into a branch in the root directory of the wizard

I have a branch that contains the contents of the main branch as a subdirectory. Now I have made some changes to this subdirectory. Ideally, I want to be able to merge these changes back into the main branch.

Branch:

index.html subdirectory > a.txt > b.txt 

Master layout

 a.txt b.txt 

How can I do it? Is this even a good approach? In SVN, I avoided merging the subdirectories back into the trunk. But this is a slightly different use case, the location of both the branch and the wizard will never change.

+4
source share
2 answers

You may try

  • creating a branch from your current branch ( git branch to_be_merge_to_master )
  • moving your file to the correct structure ( git mv ... )
  • merging this second branch with the master
+1
source

use git submodules

+1
source

Source: https://habr.com/ru/post/1302429/


All Articles