I've got the branches feature1
and master
.
Then in feature1
I renamed a file dir/file.txt
into dir2/file2.txt
.
After that I altered the file in master
and a week later altered the file in feature1
too.
I have 40 files changed like that across the project.
When I try to merge master
into feature1
I'm using low renaming threshold.
Most of the files are auto-merged correctly. Some files are offered for manual conflict resolution.
But some concrete files neither appear in the merge
response as auto-merged,
nor getting merged properly. Under properly I expect one of two outcomes I could resolve:
1. It wouldnt detect renaming and just add me another dir/file.txt
into the feature1
branch.
2. It would detect renaming and offer me to manually resolve conflict.
There are many changes when I view them withgit difftool master:dir/file.txt feature1:dir2/file2.txt
Therefore I assume that git recognizes the renaming and decides to keep my version without informing me about what's going on. How can I solve it / debug it ?
This is the command I use
git config merge.renameLimit 9999999999
git merge --no-ff -Xrename-threshold=20 -Xignore-space-change master
While working with feature1
branch, I had deleted dir/file.txt
.
Maybe git assumes this file should be deleted and therefore ignores it's existence in master
.
Renaming detection fails, although the similarity of the files is kept ( levenshtein distance is less than 2% of the content's length )
Another discussion suggests 'manual merge' copying files from branch to branch.
Some other files are resolved correctlyCONFLICT (rename/delete): images/ab.gif deleted in master and renamed in HEAD. Version HEAD of cdn/img/ab.gif left in tree.
Files that were removed in master
and merged into feature1
are resolved correctly. Files that are deleted (or moved) in feature1
ain't recognized at the merge.
Sugestions?
At the moment I'm trying to merge the other way around. Merge feature1
into master
and see what files
are being added and removed. This way I'll a list of files git fail's to recognize as renames and resort to manual merging.
If you remove a file in one branch, the merge will remove it in the target branch too.
Given that, there are multiple ways to remove a file from a Merge Request, such as: As you proposed, you can add a new commit to your source branch which effectively undoes the changes to the files you no longer wish to include. This could mean undoing the changes to existing tracked files, or deleting untracked files.
The Rebase Option But, instead of using a merge commit, rebasing re-writes the project history by creating brand new commits for each commit in the original branch. The major benefit of rebasing is that you get a much cleaner project history. First, it eliminates the unnecessary merge commits required by git merge .
If you are deleting files from your repo - git is tracking this deletion and the merge is considering this when determining what to do.
This is probably not all that you have going on, but it is part of it. You can try git add'ing them again.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With