user571470
user571470

Reputation: 404

git merge after file renamed

I have two files A and B in master. I created a branch feature where I modified both A and B. Then, someone else deleted B and renamed A to B in master (using git mv).

When I merge feature into master, git compares B in feature with B in master, which is not as what I expected, because the content of B is actually the content of A in master.

Is there any built-in feature that can link A in feature with B in master when I merge it?

Upvotes: 2

Views: 516

Answers (2)

Adam Dymitruk
Adam Dymitruk

Reputation: 129762

rename the file to match in either side or change the threshold percentage until git sees them as the same file. I believe it's the -M option.

Upvotes: 1

Clukester
Clukester

Reputation: 132

What is going to happen to B in your master branch? If A is supposed to be called B then why not just rename it in your feature branch as well. Of course first rename B to something else like C, and it will merge normally.

Upvotes: 0

Related Questions