Knowledge Base

¿Qué es esto?

git: Cambiar mensaje de un commit anterior

23/02/2016 - 27/12/2018 -  Comentarios - git Commit

Si queremos cambiar el mensaje de nuestro último commit, ejecutar:

git commit --amend

Que nos mostrará una pantalla donde podremos escribir el nuevo mensaje. O podemos poner el mensaje directamente:

git commit --amend -m "New commit message"

Si el commit ya se hubier subido habría que forzar el push de la rama (OJO!!! esto eliminaría cualquier otro commit hecho por cualquier otro usuario)

git push <remote> <branch> --force

Para hacerlo con un commit anterior habría que hacer un rebase (Esto no lo he probado):

http://stackoverflow.com/questions/1186535/how-to-modify-a-specified-commit-in-git