git aplica cambios de un commit a otra rama
Quiero hacer algo similar a git rebase pero sin colapsar confirmaciones paralelas.
Digamos que tengo las siguientes confirmaciones:
B (bar)
/
A-C-D (foo)
Ahora quiero tomar los cambios que D introdujo a C en la rama foo, y aplicarlos a B en la barra de ramas. así que termino con lo siguiente:
B-E (bar)
/
A-C-D (foo)
Donde la diferencia entre commits B y E es igual a la diferencia entre commits C y D. ¿Es esto posible? ¿Hay alguna manera de hacerlo sin crear un parche?
26
2 answers
Sí:
git checkout -b mergebranch B
git cherry-pick D
36
Author: cforbish,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-06-12 16:10:12
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-06-12 16:10:12
Si el último commit en la rama de la que quieres cherry-pick (foo en el ejemplo) es un commit de fusión, puedes apuntar al commit específico a cherry pick usando git cherry-pick branchname~1
para obtener el commit que fue el padre de la fusión.
0
Author: aaaarrgh,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-02-05 01:25:55
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-02-05 01:25:55