LanguagesNamedAfterCofee
LanguagesNamedAfterCofee

Reputation: 5952

Git merge with different histories

I have two branches, both with different commit histories. However, currently, the files in both branches are the exact same.

Now, if I make commits from now on to master, how can I merge the second branch with them?

Upvotes: 3

Views: 2495

Answers (1)

mvp
mvp

Reputation: 116058

Suppose you have two branches, master and devel, and their actual file content is currently identical (git diff master devel prints empty output). You can merge these branches using this:

git checkout master
git merge -s ours devel

-s ours means using ours strategy, that is, master content prevails over devel content. However, since devel file content is exactly the same, it should not make any difference for you. However, devel history will be present in git log, even if you were to delete devel branch altogether.

Upvotes: 7

Related Questions