[EN/ESP] Learn about Git // Aprende Sobre Git

in Programming & Dev4 years ago

Hello hive friends, this time I want to share with you about a super necessary tool for every developer, nothing more and nothing less than Git if you already know what Git is, it is good to remember this tool a little. .. without anything else to say, I am José Sojo and I leave you with the explanation:

Hola hive amigos en esta ocasión quiero compartirles sobre una herramienta súper necesaria para todo desarrollador, nada más y nada menos que de Git si ya sabes lo que es Git bueno no está de más recordar un poco está herramienta... sin nada más que decir, soy José Sojo y los dejo con la explicación:

What is Git?

¿Que es Git?

GIT most widely used open source version control system that allows you to track changes made to files.

GIT sistema de control de versiones de código abierto más utilizado que te permite rastrear los cambios realizados en los archivos.

A GIT project consists of three main sections: the working directory, the staging area, and the git directory.

Un proyecto GIT consta de tres secciones principales: el directorio de trabajo, el área de preparación y el directorio git.

The working directory is where files are added, deleted, and edited. The changes are then staged (indexed) in the staging area. After you commit your changes, the snapshot of the changes will be saved in the git directory.

El directorio de trabajo es donde se agregan, borran y editan los archivos. Luego, los cambios son preparados (indexados) en el área de preparación. Después de que confirmes tus cambios, la instantánea de los cambios se guardará en el directorio git.

Now How to use Git to change the states of the files? We do it using some commands that git provides us

Ahora ¿Cómo utilizamos Git para cambiar los estados de los archivos? lo hacemos utilizando algunos comandos que nos proporciona git

git init: will create a new local GIT repository. The following Git command will create a repository in the current directory (.git):

git init: creará un nuevo repositorio local GIT. El siguiente comando de Git creará un repositorio en el directorio actual (.git):

	git init

git add: is used to add files to the staging area. For example, the following basic Git command will index the file "index.html", a period (.) To add all the files:

git add: se usa para agregar archivos al área de preparación. Por ejemplo, el siguiente comando de Git básico indexará el archivo "index.html", un punto (.) para agregar todos los archivos:

	git add index.html
	git add .

git commit: will create a snapshot of the changes and save it in the git directory, we must specify a message using the command "-m" and the message in quotes:

git commit: creará una instantánea de los cambios y la guardará en el directorio git, debemos especificarle un mensaje utilizando el comando "-m" y el mensaje entre comillas:

	git commit -m 'to add index.html'

git status: shows the list of the files that have been changed along with the files that are about to be prepared or committed:

git status: muestra la lista de los archivos que se han cambiado junto con los archivos que están por ser preparados o confirmados:

git status git status -s

git clone: is used to copy a repository. If the repository is on a remote server, we must pass it the "url" of the repository that we want to clone

git clone: se usa para copiar un repositorio. Si el repositorio está en un servidor remoto, debemos pasarle la "url" del repositorio que queremos clonar

	git clone 'url'

git push: is used to send local commits to the master branch of the remote repository; & lt; master & gt; It is the branch where we want to send the changes, calm later I will comment on the branches:

git push: se usa para enviar confirmaciones locales a la rama maestra del repositorio remoto; <master> es la rama a donde queremos enviar los cambios, tranquilo más adelante te comentaré sobre las ramas:

	git push origin <master>

git checkout: create to branch

git checkout: crea una rama

	git checkout <name to branch to create>

git checkout: change to branch

git checkout: cambia de rama

	git checkout <name-to-branch-to-change>

git branch: Show the branches

git branch: Muestras las ramas

	git branch
	git branch -a

git branch: Remove the specific branch

git branch: Elimina la rama especificada
 git branch -d <branch-name> 

git remote: allows you to see all added remote repositories

git remote: te permite ver todos los repositorios remotos agregados

	git remote -v

git remote: Add a remote repository

git remote: Agrega un repositorio remoto

	git remote add origin <remote-url>

git remote: delete a remote repository

git remote: elimina un repositorio remote

	git remote remove

git pull: fusiona todos los cambios que se han hecho en el repositorio remoto con el directorio de trabajo local:

	git pull

git pull: merges all the changes that have been made in the remote repository with the local working directory:

git log: Se usa para ver el historial del repositorio listando ciertos detalles de la confirmación. Al ejecutar el comando se obtiene una salida como ésta

	git log

	commit 15f4b6c44b3c8344caasdac9e4be13246e21sadw
	Author: José Sojo <jose_sojo@gmail.com>
	Date:   Mon Nov 4 12:56:29 2021

git reset: It is used to reset the index and the working directory to the last commit state:

git reset: Sirve para resetear el index y el directorio de trabajo al último estado de confirmación:

	git reset - -hard HEAD

git rm: Can be used to remove files from the index and working directory:

git rm: Se puede usar para remover archivos del index y del directorio de trabajo:

	git rm index.html

git fetch: allows the user to search for all objects from a remote repository that are not currently in the local working directory:

git fetch: le permite al usuario buscar todos los objetos de un repositorio remoto que actualmente no se encuentran en el directorio de trabajo local:

	git fetch origin

git gc: will clean up unnecessary files and optimize the local repository

git gc: limpiará archivos innecesarios y optimizará el repositorio local

	git gc

And good friends, these are some commands that every developer should know. In my opinion, they are very important commands that I have used a lot when I am working with git, whether for a personal project or a professional project.

Y buenos amigos esos son unos comandos que todo desarrollador debe conocer a mi parecer son unos comandos muy importantes que yo eh utilizado mucho cuando estoy trabajando con git ya sea para un proyecto personal o un proyecto profesional

The images were developed in the GIMP application in its Windows 7 distribution

Las imágenes fueron desarrolladas en la aplicación GIMP en su distribución de Windows 7

Without more to say my name is José Sojo, and we will read each other in the next

Sin más que decir mi nombre es José Sojo, y nos leemos en la próxima