Showing posts with label git. Show all posts
Showing posts with label git. Show all posts

Wednesday, August 30, 2023

Create new repo from terminal in macOS

In Windows, we are used to right click into our folder and open With GitBash. Let’s do something similar in macOs


Go to Finder (it’s in the Dock), open Documents, create new folder, let’s say “MyRepos”, Ctrol+Click the folder and New terminal at Folder.

In the terminal, continue doing what you already know…


git init

git add …

git commit …

Blah blah

Install and Config GIT on MAC


The best option to install GIT in Mac is thru Homebrew. So, you should install it first


Open launchpad, search by “terminal”

Run this command:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"


(Visit the official website to get the news: https://brew.sh)


All you need to do is to wait and read the console. The console will ask you to do something (copy a command, past it and run it)


Now you are ready to install GIT thru this command:

brew install git (Visit the official website to get the news: https://git-scm.com/download/mac)


Run git —version to confirm you already have git installed


Unlike Windows, you will not get a new terminal


Now you have GIT, next step is to configure GIT


In the same terminal, run this:


git config —global user.name “your-username”

git config —global user.email “your-email”


You can see your configuration running this:

git config —list


Voila

Friday, May 17, 2019

¿Qué es Git LFS y cómo implementarlo?

LFS significa Large File Storage o en español Almacenamiento de archivos grandes.

Pero, ¿qué es lo que hace realmente?

Resulta que cuando versionamos código, éstos suelen ser planos, simples archivos que si lo pesamos, no representan un peso significativo. Y cuando hacemos push al servidor remoto, git crea una copia con los cambios y hasta ahí todo perfecto. Pero ¿qué tal si queremos versionar archivos cuyo peso puede significar un problema para nuestro repositorio? Se imaginan versionar un .dll por ejemplo.

Aquí es donde entra "git lfs". Veamos la siguiente imagen:



Cuando usamos git lfs, los archivos grandes no se suben al respositorio remoto sino unicamente se crea un acceso directo cuyo peso comparado con el archivo real será de bastante consideración.

Cómo implementar git lfs

1. Descarga e Instala https://git-lfs.github.com/

2. Crea e incializa tu repositorio

3. Ejecuta git lfs install

4. Selecciona los typos de archivos que quisieras que Git LFS administre:

git lfs track "*.psd, *.dll" 

5. Un archivo de congifuración llamado .gitattributes será modificado donde estarán todos los tipos de archivos o extensiones que hayas configurado en el paso 4. Y como tal, deberás versionarlo

git add .gitattributes

Y eso es todo!

Happy coding! :)

Thursday, October 4, 2018

¿Cómo corregir el mensaje de un commit con GIT?

*Puedes saltarte al primer subtítulo

Seguramente muchos ya han escrito sobre el comando git "amend". Seré una más que lo hace :D

De hecho, hace unos minutos atrás tuve que hacer uso de este valioso comando.

Estuve trabajando esta semana en un feature que terminé agregando varios archivos y modificando otros tantos más (lo sé, no fue buena práctica hacer mis commits a fin del día) Pero a mi me gusta hacer commits cuando realmente es código estable (y además presentable) Por eso únicamente los guardaba en mi equipo local.

Luego, en un notepad, escribí todos mis mensajes de commits y los files que irían a incluir cada uno. Entonces, en una de esas, copié el mensaje equivocado. ¿Cómo corregir el mensaje de un commit con GIT?   Hoy quiero coma

GIT AMEND

Aquí es precisamente donde entra el comando git commit --amend

Ya sea si quieres corregir el nombre de tu mensajito (sobreescribiendo o editando) o si quieres agregar un archivo o file más a tu commit, puedes usar este comando.

Entonces,

git add xxxxx (si quieres agregar x files)

O te vas directo a ejecutar el comando amend,

git commit --amend

(se te abrirá el editor para que cambies tu mensaje)

o si quieres sobreescribir todo el mensaje

git commit --amend -m "Nuevo mensaje"

¿CUÁNDO FUNCIONA?

Lo previamente visto te funcionará para tu último commit que no lo hayas pusheado todavía.
Pero en el caso de que ya hubieras pusheado tu commit antes de corregirlo, después de corregirlo deberás ejecutar el siguiente comando:

git push -f

PRUEBALO

Con el comando git log puedes ver que tu mensaje de commit ha sido modificado


Happy Coding :)

Monday, April 23, 2018

How to upgrade Git on Windows

1. Go to https://git-scm.com/download/win and download the .exe program



2. Execute it and follow the wizard (you do not need to uninstall your previous version of git to upgraded it to the latest)
3. That's it!