oschrenk
oschrenk

Reputation: 4209

Git Merge subdirectory to branch to root directory of master

I have a branch that has the content of the master branch as a subdirectory. Now I made some changes to this subdirectory. Ideally I want to be able to merge these changes back into the master branch.

Branch layout:

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

Master layout

a.txt
b.txt

How would I go about doing this? Is it even a good approach? In SVN I avoided merging subdirectories back into the trunk. But this is a somewhat different use case, the layout of both, the branch and master, will never change.

Upvotes: 4

Views: 1209

Answers (2)

knittl
knittl

Reputation: 265141

make use of git submodules

Upvotes: 1

VonC
VonC

Reputation: 1323175

You could try

  • making a branch from your current branch (git branch to_be_merge_to_master)
  • moving back your file to the correct structure (git mv ...)
  • merging that second branch to master

Upvotes: 1

Related Questions