\documentclass[10pt,a4paper]{article} % Packages \usepackage{fancyhdr} % For header and footer \usepackage{multicol} % Allows multicols in tables \usepackage{tabularx} % Intelligent column widths \usepackage{tabulary} % Used in header and footer \usepackage{hhline} % Border under tables \usepackage{graphicx} % For images \usepackage{xcolor} % For hex colours %\usepackage[utf8x]{inputenc} % For unicode character support \usepackage[T1]{fontenc} % Without this we get weird character replacements \usepackage{colortbl} % For coloured tables \usepackage{setspace} % For line height \usepackage{lastpage} % Needed for total page number \usepackage{seqsplit} % Splits long words. %\usepackage{opensans} % Can't make this work so far. Shame. Would be lovely. \usepackage[normalem]{ulem} % For underlining links % Most of the following are not required for the majority % of cheat sheets but are needed for some symbol support. \usepackage{amsmath} % Symbols \usepackage{MnSymbol} % Symbols \usepackage{wasysym} % Symbols %\usepackage[english,german,french,spanish,italian]{babel} % Languages % Document Info \author{paulafarias (paulafarias)} \pdfinfo{ /Title (git-github-espanol.pdf) /Creator (Cheatography) /Author (paulafarias (paulafarias)) /Subject (Git - GitHub (Español) Cheat Sheet) } % Lengths and widths \addtolength{\textwidth}{6cm} \addtolength{\textheight}{-1cm} \addtolength{\hoffset}{-3cm} \addtolength{\voffset}{-2cm} \setlength{\tabcolsep}{0.2cm} % Space between columns \setlength{\headsep}{-12pt} % Reduce space between header and content \setlength{\headheight}{85pt} % If less, LaTeX automatically increases it \renewcommand{\footrulewidth}{0pt} % Remove footer line \renewcommand{\headrulewidth}{0pt} % Remove header line \renewcommand{\seqinsert}{\ifmmode\allowbreak\else\-\fi} % Hyphens in seqsplit % This two commands together give roughly % the right line height in the tables \renewcommand{\arraystretch}{1.3} \onehalfspacing % Commands \newcommand{\SetRowColor}[1]{\noalign{\gdef\RowColorName{#1}}\rowcolor{\RowColorName}} % Shortcut for row colour \newcommand{\mymulticolumn}[3]{\multicolumn{#1}{>{\columncolor{\RowColorName}}#2}{#3}} % For coloured multi-cols \newcolumntype{x}[1]{>{\raggedright}p{#1}} % New column types for ragged-right paragraph columns \newcommand{\tn}{\tabularnewline} % Required as custom column type in use % Font and Colours \definecolor{HeadBackground}{HTML}{333333} \definecolor{FootBackground}{HTML}{666666} \definecolor{TextColor}{HTML}{333333} \definecolor{DarkBackground}{HTML}{275DA3} \definecolor{LightBackground}{HTML}{F1F4F9} \renewcommand{\familydefault}{\sfdefault} \color{TextColor} % Header and Footer \pagestyle{fancy} \fancyhead{} % Set header to blank \fancyfoot{} % Set footer to blank \fancyhead[L]{ \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{C} \SetRowColor{DarkBackground} \vspace{-7pt} {\parbox{\dimexpr\textwidth-2\fboxsep\relax}{\noindent \hspace*{-6pt}\includegraphics[width=5.8cm]{/web/www.cheatography.com/public/images/cheatography_logo.pdf}} } \end{tabulary} \columnbreak \begin{tabulary}{11cm}{L} \vspace{-2pt}\large{\bf{\textcolor{DarkBackground}{\textrm{Git - GitHub (Español) Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{paulafarias (paulafarias)} via \textcolor{DarkBackground}{\uline{cheatography.com/126740/cs/24640/}}} \end{tabulary} \end{multicols}} \fancyfoot[L]{ \footnotesize \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{LL} \SetRowColor{FootBackground} \mymulticolumn{2}{p{5.377cm}}{\bf\textcolor{white}{Cheatographer}} \\ \vspace{-2pt}paulafarias (paulafarias) \\ \uline{cheatography.com/paulafarias} \\ \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Published 5th October, 2020.\\ Updated 22nd October, 2020.\\ Page {\thepage} of \pageref{LastPage}. \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Sponsor}} \\ \SetRowColor{white} \vspace{-5pt} %\includegraphics[width=48px,height=48px]{dave.jpeg} Measure your website readability!\\ www.readability-score.com \end{tabulary} \end{multicols}} \begin{document} \raggedright \raggedcolumns % Set font size to small. Switch to any value % from this page to resize cheat sheet text: % www.emerson.emory.edu/services/latex/latex_169.html \footnotesize % Small font. \begin{multicols*}{2} \begin{tabularx}{8.4cm}{x{3.04 cm} x{4.96 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{\{\{fa-git\}\} Instalación}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{Acción}}\{\{br\}\} & {\bf{Comando}} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} {\bf{Instalar Git}} & Ir a \{\{link="https://git-scm.com/"\}\}Git SCM\{\{/link\}\} \tn % Row Count 5 (+ 3) % Row 2 \SetRowColor{LightBackground} {\bf{Instalar Git en {\emph{Mac}}}} & {\bf{1)}} Instalar {\bf{\{\{link="https://brew.sh/"\}\}Homebrew\{\{/link\}\} }} si no está instalado: \{\{nl\}\} {\bf{`\$ /bin/bash -c "\$(curl -fsSL \seqsplit{https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"} `}} \{\{nl\}\}\{\{nl\}\} {\bf{2)}} En la terminal poner: \{\{nl\}\} {\bf{`\$ brew install git`}} \tn % Row Count 17 (+ 12) % Row 3 \SetRowColor{white} {\bf{Ver la versión}} & {\bf{`\$ git -{}-version`}} \tn % Row Count 19 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{4 cm} x{4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{\{\{fa-archive\}\} Repositorios (repositories)}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{Acción}} & \{\{bl\}\} {\bf{Comando}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} Crear un repositorio* & {\bf{`\$ git init`}}\{\{br\}\} \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} Ver la situación actual de los archivos & {\bf{`\$ git status`}} \tn % Row Count 5 (+ 2) % Row 3 \SetRowColor{white} Añadir un archivo al repositorio & {\bf{`\$ git add {\emph{file\_name.ext}}`}} \tn % Row Count 7 (+ 2) % Row 4 \SetRowColor{LightBackground} Añadir todos los archivos que contiene la carpeta & {\bf{`\$ git add .`}} \{\{nl\}\} {\bf{`\$ git add -A`}} \tn % Row Count 10 (+ 3) % Row 5 \SetRowColor{white} Mostrar las diferencias de archivos que no se han enviado aún al staging area & {\bf{`\$ git diff`}} \tn % Row Count 14 (+ 4) % Row 6 \SetRowColor{LightBackground} Borrar el caché de un archivo** & {\bf{`\$ git rm -{}-cached file\_name.ext`}} \tn % Row Count 16 (+ 2) % Row 7 \SetRowColor{white} \{\{bt\}\} & \{\{bt\}\} \tn % Row Count 17 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{* Primero se abre en la terminal la carpeta que contiene el proyecto del que se quiere inicializar un repositorio: `\$ cd {\emph{folder\_with\_project}}` \newline \newline **Esto se hace cuando se quiere agregar un archivo al {\emph{.gitignore}} (archivo que permite guardar archivos que no se quiere que sean públicos en el repositorio)} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{4 cm} x{4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{\{\{fa-terminal\}\} Configuraciones}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{Acción}}\{\{br\}\} & {\bf{Comando}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} Configurar el nombre de usuario para todo el sistema & {\bf{`\$ git config -{}-global user.name "my\_username"`}} \tn % Row Count 4 (+ 3) % Row 2 \SetRowColor{LightBackground} Configurar el nombre de usuario solo para el repositorio actual & {\bf{`\$ git config user.name "my\_username"`}} \tn % Row Count 8 (+ 4) % Row 3 \SetRowColor{white} Configurar el email para todo el sistema & {\bf{`\$ git config -{}-global user.email "my\_email"`}} \tn % Row Count 11 (+ 3) % Row 4 \SetRowColor{LightBackground} Configurar el email solo para el repositorio actual & {\bf{`\$ git config user.email "my\_email"`}} \tn % Row Count 14 (+ 3) % Row 5 \SetRowColor{white} Habilitar la colorización en la línea de comando & {\bf{`\$ git config -{}-global color.ui auto`}} \tn % Row Count 17 (+ 3) % Row 6 \SetRowColor{LightBackground} Eliminar todas las configuraciones globales realizadas & {\bf{`\$ git config -{}-global -{}-unset-all`}} \tn % Row Count 20 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{4 cm} x{4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{\{\{fa-clone\}\} Commit - Files}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{Acción}}\{\{br\}\} & {\bf{Comando}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} Realizar el commit de los archivos que están en staging area & {\bf{`\$ git commit -m "{\emph{Commit message}}"`}} \tn % Row Count 5 (+ 4) % Row 2 \SetRowColor{LightBackground} Mostrar todos los commits realizados & {\bf{`\$ git log`}} \{\{nl\}\} {\bf{`\$ git log -{}-oneline`}} \tn % Row Count 8 (+ 3) % Row 3 \SetRowColor{white} Revertir el commit a uno anterior* & {\bf{`\$ git revert {\emph{commit\_ID}}`}} \tn % Row Count 10 (+ 2) % Row 4 \SetRowColor{LightBackground} Deshacer todos los commits que se hicieron después del {\emph{commit\_ID}}, preservando los cambios localmente* & {\bf{`\$ git reset {\emph{commit\_ID}}`}} \tn % Row Count 16 (+ 6) % Row 5 \SetRowColor{white} Enumerar el historial de versión para un archivo, incluidos los cambios de nombre & {\bf{`\$ git log -{}-follow {\emph{file\_name}}`}} \tn % Row Count 21 (+ 5) % Row 6 \SetRowColor{LightBackground} Cambiar el nombre de un archivo & {\bf{`\$ git mv {\emph{original\_file\_name}} {\emph{new\_file\_name}}`}} \tn % Row Count 24 (+ 3) % Row 7 \SetRowColor{white} \{\{bt\}\} & \{\{bt\}\} \tn % Row Count 25 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{*Para revertir o resetear el commit, se necesita el `{\emph{commit\_ID}} `del commit al cual se quiere volver, el cual lo encontramos cuando buscamos los commits realizados con `\$ git log`} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{4 cm} x{4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{\{\{fa-sitemap\}\} Ramas (branches)}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{Acción}}\{\{br\}\} & {\bf{Comando}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} Crear una nueva rama (branch) & {\bf{`\$ git branch new\_branch\_name`}} \tn % Row Count 4 (+ 3) % Row 2 \SetRowColor{LightBackground} Ver todas las ramas del repositorio & {\bf{`\$ git branch`}} \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} Cambiar de rama a donde se quiere subir el archivo & {\bf{`\$ git checkout branch\_name`}} \tn % Row Count 9 (+ 3) % Row 4 \SetRowColor{LightBackground} Crear un nueva rama y "cambiarse" a ella & {\bf{`\$ git checkout -b new\_branch\_name`}} \tn % Row Count 12 (+ 3) % Row 5 \SetRowColor{white} Volver a la rama master & {\bf{`\$ git checkout master`}} \tn % Row Count 14 (+ 2) % Row 6 \SetRowColor{LightBackground} Unir una rama con la rama activa actualmente & {\bf{`\$ git merge {\emph{merging\_branch\_name}}`}} \tn % Row Count 17 (+ 3) % Row 7 \SetRowColor{white} Borrar una rama & {\bf{`\$ git branch -d {\emph{deleting\_branch\_name}}`}} \tn % Row Count 20 (+ 3) % Row 8 \SetRowColor{LightBackground} Forzar el borrado de una rama (force-delete) & {\bf{`\$ git branch -D {\emph{deleting\_branch\_name}}`}} \tn % Row Count 23 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{4 cm} x{4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{\{\{fa-github\}\} Repositorios remotos (GitHub)}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{Acción}}\{\{br\}\} & {\bf{Comando}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} Conectar un repositorio {\emph{local}} con un repositorio {\emph{remoto}} (en GitHub) * & {\bf{`\$ git remote add origin {\emph{repository\_url}}.git`}} \tn % Row Count 5 (+ 4) % Row 2 \SetRowColor{LightBackground} Listar los repositorios {\emph{remotos}} a los que se está conectado & {\bf{`\$ git remote -v`}} \tn % Row Count 9 (+ 4) % Row 3 \SetRowColor{white} Cambiar la url del repositorio {\emph{remoto}} al que se está conectado & {\bf{`\$ git remote set-url origin {\emph{new\_repository\_url}}`}} \tn % Row Count 13 (+ 4) % Row 4 \SetRowColor{LightBackground} Actualizar el repositorio {\emph{local}} para que tenga los últimos cambios del repositorio {\emph{remoto}} & {\bf{`\$ git pull origin master`}} \{\{nl\}\} {\bf{`\$ git pull origin branch\_name`}} \tn % Row Count 18 (+ 5) % Row 5 \SetRowColor{white} Subir los últimos cambios del repositorio {\emph{local}} al repositorio {\emph{remoto}} & {\bf{`\$ git push -u origin master`\{\{nl\}\}`\$ git push origin branch\_name`}} \tn % Row Count 22 (+ 4) % Row 6 \SetRowColor{LightBackground} Crear una copia al repositorio {\emph{local}}, clonando un repositorio {\emph{remoto}} & {\bf{`\$ git clone {\emph{repository\_url}}`}} \tn % Row Count 26 (+ 4) % Row 7 \SetRowColor{white} \{\{bt\}\} & \{\{bt\}\} \tn % Row Count 27 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{* Se hace una sola vez para conectar los repositorios.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{\{\{fa-list-ol\}\} Pasos generales para un proyecto}} \tn \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{1)}} Abrir en la terminal la carpeta que contiene el proyecto. \newline % Row Count 2 (+ 2) {\bf{`\$ cd {\emph{folder\_with\_project}}`}} \newline % Row Count 3 (+ 1) {\bf{2)}} Crear un {\emph{repositorio local}} en la carpeta del proyecto.* \newline % Row Count 5 (+ 2) {\bf{`\$ git init`}} \newline % Row Count 6 (+ 1) {\bf{3)}} Añadir al {\emph{repositorio local}} los archivos que se encuentran en la carpeta del proyecto. \newline % Row Count 8 (+ 2) {\bf{`\$ git add .`}} \newline % Row Count 9 (+ 1) {\bf{`\$ git add {\emph{file\_name.ext}}`}} \newline % Row Count 10 (+ 1) {\bf{4)}} Realizar el commit de los archivos que están en {\emph{staging area}}. \newline % Row Count 12 (+ 2) {\bf{`\$ git commit -m {\emph{"Commit message"}}`}} \newline % Row Count 13 (+ 1) {\bf{Si se quiere subir a un {\emph{repositorio remoto}} (Github):}} \newline % Row Count 15 (+ 2) {\bf{5)}} Conectar el {\emph{repositorio local}} con un {\emph{repositorio remoto}} (en GitHub)** \newline % Row Count 17 (+ 2) {\bf{`\$ git remote add origin {\emph{repository\_url.git}}`}} \newline % Row Count 19 (+ 2) {\bf{6)}} Subir los últimos cambios del {\emph{repositorio local}} al {\emph{repositorio remoto}} \newline % Row Count 21 (+ 2) {\bf{`\$ git push origin {\emph{branch\_name}}`}} \newline % Row Count 22 (+ 1) \{\{nl\}\}\{\{bb\}\}% Row Count 23 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{* Se crea solo una vez. \newline ** Se conecta solo una vez.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{4.72 cm} x{3.28 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{\{\{fa-file\}\} README. File (Markdown Syntax)}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{Acción}}\{\{br\}\} & {\bf{Markdown}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} Títulos (headers) & \# \{\{nl\}\} \#\# \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} Lista & * \{\{nl\}\} {\bf{-}} \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} Checklist & - {[} {]} \{\{nl\}\} - {[}x{]} \tn % Row Count 5 (+ 2) % Row 4 \SetRowColor{LightBackground} Negrita (bold) & ** {\bf{text}} ** \tn % Row Count 7 (+ 2) % Row 5 \SetRowColor{white} Italica & \_{\emph{text}}\_ \tn % Row Count 8 (+ 1) % Row 6 \SetRowColor{LightBackground} Coloca una linea horizontal & -{}-{}- \tn % Row Count 10 (+ 2) % Row 7 \SetRowColor{white} Link a un archivo que se encuentra en el mismo repositorio & {[}Texto{]}(nombre\_archivo) \tn % Row Count 13 (+ 3) % Row 8 \SetRowColor{LightBackground} Link a una página externa con texto propio & {[}Texto{]}(https://webpage.com) \tn % Row Count 15 (+ 2) % Row 9 \SetRowColor{white} Mencionar a un usuario (recibe notificación) & @user \tn % Row Count 17 (+ 2) % Row 10 \SetRowColor{LightBackground} Emoji & :emoji\_id: \tn % Row Count 18 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}