In one branch in one branch A a file is changed and the change commited. Now in another branch B the very same file is edited and renamed.
When merging B into A git recognises the conflict properly (CONFLICT (delete/modify)) and both files are in the working directory.
If I know want to have both changes in one file, how do I do this best?
There is git merge-file that is - if I'm right - expecting both files and a common ancestor. But how to give latter? How can I say "use $path from $commit" or something like that?
Example:
mkdir git-rename-repo
cd git-rename-repo
git init
echo "First line" > afile
git add .
git commit -m "First commit in master"
git checkout -b mybranch
echo "Second line in mybranch" >> afile
git mv afile bfile
git commit -a -m "change and rename in mybranch"
git checkout master
echo "Changed first line in master" > afile
git commit -a -m "changed afile"
git merge mybranch
I now want a file named 'bfile' with both changes:
Changed first line in master
Second line in mybranch
Thanks
question from:
https://stackoverflow.com/questions/2314437/resolve-conflict-delete-modify-in-git 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…