Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

git

git-merge

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?

like image 836
Protostome Avatar asked Jun 16 '15 09:06

Protostome


1 Answers

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.

like image 134
Harshad Kavathiya Avatar answered Oct 12 '22 14:10

Harshad Kavathiya