coding
coding

Reputation: 21

Merge Branch into a Directory GIT

I have main branch named Project

Then I have a branch named payment which consists all the project files of the application

I want to merge the branch payment into my main branch but inside a folder/directory

In other words Project branch -> Payment Application(folder) -> files of the payment branch

Upvotes: 2

Views: 57

Answers (1)

jthill
jthill

Reputation: 60235

First time:

git checkout project
git merge --no-commit -s ours payment
git read-tree -u --prefix=payment/ payment
git commit

Thereafter:

git checkout project
git merge -s subtree payment

and you're probably fine making that the default merge strategy for your project branch, puns seem unlikely:

git config branch.project.mergeoptions '-s subtree'

Upvotes: 1

Related Questions