Hello,
Consider the following use case:
git init
seq 0 9 > f
git add f
git commit -m start
git checkout -b b1
perl -pi -e 's,0,b1,' f
git commit -a -m b1
git checkout -b b2
perl -pi -e 's,9,b2,' f
git commit -a -m b2
git checkout master
git merge b1 b1
As the changes to "f" don't conflict, the octopus merge deals with them
just fine, and I get a merge in a single commit object.
Now, let's say my b1 and b2 branches are a bit more special, and apart
from the main contents (i.e. the "f" file), each branch contains a
couple of files with branch-specific metadata. The names of those files
are the same in each branch. (People familiar with topgit can probably
guess I'm talking about topgit branches here.)
I'd like to merge all such branches into "master" in one octopus-like
commit, but the metadata files introduce a conflict during simple
octopus merge. However I don't care about that metadata when the
branches are merged into "master", so I'm trying to write a script which
would do such merge while discarding the metadata files.
The problem is, I cannot get it to work, when two branches modify the
same file (like "f" above), even if the changes don't conflict. I get
either:
error: Entry 'f' would be overwritten by merge. Cannot merge.
- when trying to use the two-arg form of "git read-tree -m -i"
or:
f: needs merge
- when trying to use the three-arg form
Attached is the minimal test case that reproduces the problem.
It might just be that git-read-tree cannot do what I need, and I'm just
misinterpreting the meaning of:
"the index file saves and restores with all this information, so you
can merge things incrementally,"
which I took to mean that I can read from multiple trees one by one
before writing the tree.
Could anyone give me some hints?
--
Marcin Owsiany http://marcin.owsiany.pl/
GnuPG: 2048R/02F946FC 35E9 1344 9F77 5F43 13DD 6423 DBF4 80C6 02F9 46FC
"Every program in development at MIT expands until it can read mail."
-- Unknown
testcase.sh
Description: Bourne shell script