Protostome
Protostome

Reputation: 6039

Why does 'git merge' add files ending with tilde?

I'm in the process of merging two git branches that are fairly diverged. After the automatic merge is complete, I ended up having multiple files having two versions:

file.cc~HEAD
file.cc~branchA

While the original file.cc was gone. Since both files are identical, I'm slightly puzzled. Why does it happen? Which kind of conflict does it represent?

Upvotes: 9

Views: 1727

Answers (1)

Harshad Kavathiya
Harshad Kavathiya

Reputation: 10344

As you mention that you are trying to merge two git branches that are fairly diverged. So in this situation, automatic merge fail.

Ideally, this situation occurs when your local file let say file.cc and file in the other branch in which you are merging are fairly diverged or lack any common ancestor so they cannot be merged. And then, we must keep both files in the working directory but as a conflict. So file.cc~HEAD and file.cc~branchA files created and original file file.cc deleted.

For more information on git merge read this article.

Upvotes: 1

Related Questions