假设我有一个带有两个分支的 git 存储库 -main和custom. 假设我正在工作,custom并对文件进行了两项更改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";
同时说,我拉了一个新的main分支副本,它有以下更改print.php:
echo "This should also be printed in both branches";
我应该怎么做——无论是使用命令行还是使用像 Tower 这样的 git 程序(甚至是制作自定义脚本的建议)——才能获得以下结果文件?
主分支中的 print.php
...
echo "I want this printed in both branches";
echo "This should also be printed in both branches";
...
自定义分支中的 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";
echo "This should also be printed in both branches";
...
显然,echo "I want this..."and的顺序echo "This should also..."不是 Git 可以弄清楚的,所以这里会有一些手动决策。但我想知道如何以最“Git”的方式做到这一点,并且涉及来自像 Tower 这样的程序的最少数量的错误消息。