¿Cómo descargar un solo commit-diff desde GitHub?
Me gustaría obtener un solo commit (llamémoslo ${SHA}
) de GitHub a través de la interfaz web.
Por ejemplo, algo como:
$ git clone http://github.com/foo/bar
$ cd bar
$ git format-path -o .. ${SHA}~1..${SHA}
$ cd ..
$ rm -rf bar
...pero sin tener que clonar todo el repositorio (el repositorio en la pregunta es grande).
Obviamente GitHub puede mostrar el diff de una confirmación dada a través de la interfaz web, pero ¿cómo puedo extraer eso en un archivo diff (unificado) (idealmente con el mensaje de confirmación intacto)?
71
2 answers
OK, encontré la respuesta yo mismo.
Agregar .patch
(o .diff
) a la URL de confirmación dará un buen parche:
https://github.com/foo/bar/commit/${SHA}.patch
Gracias a Diez Cosas Que No Sabías Que Git Y GitHub Podían Hacer...
131
Author: umläute,
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
2016-08-04 10:51:48
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
2016-08-04 10:51:48
Encontré que tenía que agregar un / al final, es decir,
https://github.com/foo/bar/commit/${SHA}.patch/
1
Author: Jan,
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
2018-09-09 04:59:34
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
2018-09-09 04:59:34