Say I have a git repository with two branches - main
and custom
. Say that I'm working in custom
and I make two changes to the file print.php
:
/* begin custom only change */
echo "I'm only printed in the custom branch version";
/* end custom only change */
echo "I want this printed in both branches";
Say also that meanwhile, I've pulled a new main
branch copy, and it has the following change to print.php
:
echo "This should also be printed in both branches";
What should I do -- either with the command-line or with a git program like Tower (or even suggestions for making a custom script) -- in order to have the following resulting files?
print.php in main branch
...
echo "I want this printed in both branches";
echo "This should also be printed in both branches";
...
print.php in custom branch
...
/* begin custom only change */
echo "I'm only printed in the custom branch version";
/* end custom only change */
echo "I want this printed in both branches";
echo "This should also be printed in both branches";
...
Obviously the order of the echo "I want this..."
and echo "This should also..."
is not something that Git can figure out, so there's going to be some manual decision-making here. But I want to know how to do it in the most "Git" way possible and involving the least number of error messages from a program like Tower.