Reputation: 16546
I have a master branch and a feature branch. Both contain the Bar.cs file. However when I try to merge feature into master, it reports that the file Bar.cs was deleted on the feature branch. But Bar.cs was never deleted on feature and as I said, both files are present on both branches.
A git log of the file Bar.cs on master returns the following:
commit daaf6bd6c8d2a38b839fae44234ceef2a0c9e188
Author: xxxx
Date: Fri Jun 28 10:17:18 2013 +0000
Renamed Foo.cs to Bar.cs
A git log of the file Bar.cs on feature returns the following:
commit 93dea9f7a2b9474c169bf8a49c5a721572a9d369
Author: xxxx
Date: Fri Jul 5 16:14:46 2013 +0000
Another change
commit de9fbe3ae13ccdac8a540c653af10abb1a2f1006
Author: xxxx
Date: Tue Jul 2 16:03:43 2013 +0000
Renamed Foo.cs to Bar.cs
As you can see, in feature I merged the change from master on Jul 2, then made one other change to the file on Jun 28.
When I try to merge, git says:
CONFLICT (rename/delete): Bar.cs deleted in feature and renamed in HEAD. Version HEAD of Bar.cs left in tree.
Any idea what's happening?
Upvotes: 4
Views: 467
Reputation: 629
Had the same problem during a merge between two branches synced from a SVN repository with the git-svn
tool.
Some files were renamed on master
branch and updated on feature
branch, but git detected these files as deleted on the feature
side:
CONFLICT (rename/delete): Classes/A.m deleted in feature and renamed in HEAD. Version HEAD of Classes/A.m left in tree.
The solution was to change the merge strategy to resolve
instead of the default recursive
:
git merge -s resolve feature
Upvotes: 3
Reputation: 36775
Since the problematic commits seem to be the exact same thing you can try interactively rebasing feature
ontop master
:
git checkout feature
git rebase -i master
an editor will pop up to let you chose wich commits to pick. Delete the line with the commit de9fbe
. This will then re-apply all commits except the rename in feature
.
Afterwards, merging can be done using
git checkout master
git merge --no-ff feature
Upvotes: 0