What I would like to do is as follows;
Branch A;
|
|
\ main.c
\ void foo() {...}
\ void bar() {}
Branch B;
|
|
\ bar.c
\ void bar() {...}
That is to say, with A
as the main branch, and B
as the child branch, I would like to merge the contents of bar.c
from B
into main.c
from A
. The only shared content between bar.c
and main.c
is the definition void bar()
(and this is, in fact, the only contents of bar.c
); the contents of this function are written in B
to be merged into A
. Alterations to void bar()
should only occur in bar.c
, within branch B
to be patched in, as necessary.
I have seen similar functionality in 'diff' files (see here, for instance) and appreciate something of an answer is available here but this seems to pertain to files which are identical, unless I have misunderstood, where I intend the file in branch B
to only contain a part of the primary file, main.c
.
Thank you.
main
) would correspond to a different section that is written independently. I could use a single file and edit it, as you intimate, but given the size of file I envision working with, having the flexibility to work on a single section and 'patch' this in would be preferable, if possible.git merge <branch-name> --no-commit
, which pauses after the stage but before the commit, and then run a custom script to do what you want, then (stage and) commit your changes. At least that would be reusable.