Philip Oakley
Philip Oakley

Reputation: 14071

git : how to create a merge with a known outcome

I'm creating a potted project history in git from a series of zip snapshots taken during the project's early development. We know we (me & him) have some cases where we diverged from a base point A, then merged our two versions B & C, back into an agreed update of version D. Typically we used Beyond Compare, and in a few places we updated the code to resolve conflicts.

So I can create A--B on branch 'his', and and A--C on branch 'mine' without any problems. I'm just unsure how I would best create a merge commit that has the known outcome of D. I can easily set up the index/staging area with D waiting in it, direct from the zip file.

What's the best command(s) to create the [two parent commit] merge with pre-defined result? For the purpose of this case, 'his' is considered the primary parent.

Upvotes: 2

Views: 60

Answers (1)

Mat
Mat

Reputation: 206861

Simply doing a:

git merge --no-commit ...

followed by simply squashing everything with your known outcome and committing should work.

Upvotes: 1

Related Questions