Curso Git #17 - Git diff

in #spanish7 years ago (edited)

Hola a todos, espero que se encuentren muy bien! 🤓 😎

En este post vamos a hablar de un comando muy usado en git $ git diff

Este comando nos sirve para diferenciar los cambios que hemos hecho en un commit u otro, es decir nos muestra si hemos quitado o agregado algunas líneas de código en los diferentes archivos, según los commits que hayamos publicado en nuestro repositorio.

git diff [SHA-1] : Muestra las diferenias del commit [SHA-1] contra el ultimo commit de la rama en la que actuamente estamos (generalmente master)

git diff [XXX-1] [XXX-2] : Muestra las diferencias del commit [XXX-1] contra el commit [XXX-2]

A continuación vemos un ejemplo de los cambios realizados en un proyecto de prueba...

Esos son los commits que hay hasta el momento, el último fue donde agregamos el párrafo 2 como vemos en la imagen...

Ahora ejecutamos el siguiente comando $ git diff idCommit

y obtenemos el siguiente resultado.

Como ven tenemos el código y aparece un más (+) o menos (-) respectivamente si se ha agregado o eliminado una línea.

Esto es básicamente lo que hace este comando, también se puede usar entre diferentes commits.

Bueno eso es todo por este post, espero que sigan comentando y dale seguir.

Saludos! 🤓 😎

Sort:  

This post has been ranked within the top 10 most undervalued posts in the first half of Oct 18. We estimate that this post is undervalued by $96.23 as compared to a scenario in which every voter had an equal say.

See the full rankings and details in The Daily Tribune: Oct 18 - Part I. You can also read about some of our methodology, data analysis and technical details in our initial post.

If you are the author and would prefer not to receive these comments, simply reply "Stop" to this comment.

Este Post ha recibido un Upvote desde la cuenta del King: @dineroconopcion, El cual es un Grupo de Soporte mantenido por 5 personas mas que quieren ayudarte a llegar hacer un Top Autor En Steemit sin tener que invertir en Steem Power. Te Gustaria Ser Parte De Este Projecto?

This Post has been Upvote from the King's Account: @dineroconopcion, It's a Support Group by 5 other people that want to help you be a Top Steemit Author without having to invest into Steem Power. Would You Like To Be Part of this Project?

Congratulations! This post has been upvoted from the communal account, @minnowsupport, by juanpchica from the Minnow Support Project. It's a witness project run by aggroed, ausbitbank, teamsteem, theprophet0, someguy123, neoxian, followbtcnews/crimsonclad, and netuoso. The goal is to help Steemit grow by supporting Minnows and creating a social network. Please find us in the Peace, Abundance, and Liberty Network (PALnet) Discord Channel. It's a completely public and open space to all members of the Steemit community who voluntarily choose to be there.

This post has received a 0.78 % upvote from @drotto thanks to: @banjo.

Coin Marketplace

STEEM 0.17
TRX 0.15
JST 0.028
BTC 57951.76
ETH 2347.51
USDT 1.00
SBD 2.36