\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{mike-zr} \pdfinfo{ /Title (git-and-github.pdf) /Creator (Cheatography) /Author (mike-zr) /Subject (Git \& GitHub 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}{152F75} \definecolor{LightBackground}{HTML}{F7F8FA} \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 Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{mike-zr} via \textcolor{DarkBackground}{\uline{cheatography.com/123658/cs/23379/}}} \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}mike-zr \\ \uline{cheatography.com/mike-zr} \\ \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Not Yet Published.\\ Updated 19th June, 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*}{4} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{Starting A Repo}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{{\bf{git init}}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{Initializes a Git repo in current directory.} \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{{\bf{git init \textless{}folder\textgreater{}}}} \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{Initializes a Git repo in \textless{}folder\textgreater{} in current directory. Creates \textless{}folder\textgreater{} if it doesn't exist.} \tn % Row Count 5 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{Staging And Committing}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{{\bf{git add \textless{}file\textgreater{}}}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{Adds \textless{}file\textgreater{} to staging area.} \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{{\bf{git add .}}} \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{Adds all files in current directory to staging area.} \tn % Row Count 5 (+ 2) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{{\bf{git commit -m "\textless{}commit message\textgreater{}"}}} \tn % Row Count 6 (+ 1) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{Commits files in staging area with a commit message.} \tn % Row Count 8 (+ 2) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{{\bf{git commit}}} \tn % Row Count 9 (+ 1) % Row 7 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{Opens Git's default editor to write a commit message (can be multi-line). Save and exit to commit files in staging area with the commit message.\{\{nl\}\}{\emph{Ctrl+W=exit}}} \tn % Row Count 13 (+ 4) % Row 8 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{{\bf{git commit -am "\textless{}commit message\textgreater{}"}}} \tn % Row Count 14 (+ 1) % Row 9 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{Adds modified files to staging area and commits them. (Omitting the -m flag will open default editor for commit message.)} \tn % Row Count 17 (+ 3) % Row 10 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{{\bf{git reset HEAD \textless{}file\textgreater{}}}} \tn % Row Count 18 (+ 1) % Row 11 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{Removes \textless{}file\textgreater{} from staging area.} \tn % Row Count 19 (+ 1) % Row 12 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{{\bf{git checkout -{}- \textless{}file\textgreater{}}}} \tn % Row Count 20 (+ 1) % Row 13 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{Undoes changes made to \textless{}file\textgreater{}, reverting back to last known state of \textless{}file\textgreater{} in the repo.} \tn % Row Count 22 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{Renaming And Deleting Files}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{{\bf{git mv \textless{}file\textgreater{} \textless{}new name\textgreater{}}}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{Stages the renaming of \textless{}file\textgreater{}. The renaming takes place once committed.} \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{{\bf{git add -u}}} \tn % Row Count 4 (+ 1) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{Stages deletions.} \tn % Row Count 5 (+ 1) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{{\bf{git add -A}}} \tn % Row Count 6 (+ 1) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{Stages both changes/additions and deletions. In effect also stages renaming of files.\{\{nl\}\}(git add . does almost the same thing, read more \{\{link="https://gist.github.com/dsernst/ee240ae8cac2c98e7d5d"\}\}HERE\{\{/link\}\} and \{\{link="https://stackoverflow.com/questions/572549/difference-between-git-add-a-and-git-add"\}\}HERE\{\{/link\}\}.)} \tn % Row Count 13 (+ 7) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{{\bf{git rm \textless{}file\textgreater{}}}} \tn % Row Count 14 (+ 1) % Row 7 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{Stages the deletion of \textless{}file\textgreater{}. Committing will complete the deletion.} \tn % Row Count 16 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{{\emph{Using Git to rename and delete files (as opposed to using the operating system GUI) gives the benefit of Git automatically tracking the renaming and deleting. If you rename a file outside of Git, it will see the file as being deleted along with a new untracked file with the new name.}}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{Information}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{{\bf{git status}}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{Returns the status of file changes, as well as new files.} \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{{\bf{git log}}} \tn % Row Count 4 (+ 1) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{Returns all commits that are a part of the repo.} \tn % Row Count 5 (+ 1) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{{\bf{git show}}} \tn % Row Count 6 (+ 1) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{Returns the last commit with a diff of the changes made. {\emph{(Press Q to get out of show command)}}} \tn % Row Count 8 (+ 2) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{{\bf{git ls-files}}} \tn % Row Count 9 (+ 1) % Row 7 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{Returns what files Git is tracking.} \tn % Row Count 10 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{Differences}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{{\bf{git diff}}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{Shows the difference between what's recently changed in the working directory versus the HEAD position in the repo (which is usually the last commit on the branch).} \tn % Row Count 5 (+ 4) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{{\bf{git difftool}}} \tn % Row Count 6 (+ 1) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{Opens the configured diff tool (e.g. P4Merge), and shows the difference between what's recently changed in the working directory versus the HEAD position in the repo (which is usually the last commit on the branch).} \tn % Row Count 11 (+ 5) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{{\bf{git diff \textless{}commit id A\textgreater{} \textless{}commit id B\textgreater{}}}} \tn % Row Count 12 (+ 1) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{Shows the differences between two commits (one of the commit id's can be HEAD).} \tn % Row Count 14 (+ 2) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{{\bf{git difftool \textless{}commit id A\textgreater{} \textless{}commit id B\textgreater{}}}} \tn % Row Count 15 (+ 1) % Row 7 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{Opens the configured diff tool (e.g. P4Merge) and shows the differences between two commits (one of the commit id's can be HEAD).\{\{nl\}\}{\emph{In P4Merge press Ctrl+Q to cycle to the next file involved in the diff.}}} \tn % Row Count 20 (+ 5) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{Branching And Merging}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{{\bf{git branch}}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{Lists local branches and shows which one you're currently on.} \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{{\bf{git branch -a}}} \tn % Row Count 4 (+ 1) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{Lists all branches, including remotes, and shows which one you're currently on.} \tn % Row Count 6 (+ 2) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{{\bf{git checkout \textless{}branch\textgreater{}}}} \tn % Row Count 7 (+ 1) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{Switches to \textless{}branch\textgreater{}.} \tn % Row Count 8 (+ 1) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{{\bf{git checkout -b \textless{}branch\textgreater{}}}} \tn % Row Count 9 (+ 1) % Row 7 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{Creates a new \textless{}branch\textgreater{} then switches to it.} \tn % Row Count 10 (+ 1) % Row 8 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{{\bf{git merge \textless{}branch\textgreater{}}}} \tn % Row Count 11 (+ 1) % Row 9 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{Merges \textless{}branch\textgreater{} into the current branch. If there are conflicts, resolving them and committing will complete the merge.} \tn % Row Count 14 (+ 3) % Row 10 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{{\bf{git mergetool}}} \tn % Row Count 15 (+ 1) % Row 11 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{While in a merging state, opens the configured merge tool (e.g. P4Merge).} \tn % Row Count 17 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{Tags}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{{\bf{git tag \textless{}tag name\textgreater{}}}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{Creates a lightweight tag at the current commit.} \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{{\bf{git tag \textless{}tag name\textgreater{} \textless{}branch\textgreater{}}}} \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{Creates a lightweight tag at the last commit on \textless{}branch\textgreater{}.} \tn % Row Count 5 (+ 2) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{{\bf{git tag -d \textless{}tag name\textgreater{}}}} \tn % Row Count 6 (+ 1) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{Deletes the tag.} \tn % Row Count 7 (+ 1) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{{\bf{git tag -a \textless{}tag name\textgreater{} -m "\textless{}annotation\textgreater{}"}}} \tn % Row Count 8 (+ 1) % Row 7 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{Creates an annotated tag at the current commit.} \tn % Row Count 9 (+ 1) % Row 8 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{{\bf{git tag -a \textless{}tag name\textgreater{} -m "\textless{}annotation\textgreater{}" \textless{}commit id\textgreater{}}}} \tn % Row Count 11 (+ 2) % Row 9 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{Creates an annotated tag at the specified commit.} \tn % Row Count 12 (+ 1) % Row 10 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{{\bf{git tag -{}-list}}} \tn % Row Count 13 (+ 1) % Row 11 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{Lists tags.} \tn % Row Count 14 (+ 1) % Row 12 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{{\bf{git show \textless{}tag\textgreater{}}}} \tn % Row Count 15 (+ 1) % Row 13 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{Shows the details of the commit associated with the \textless{}tag\textgreater{}, and the annotation if there is one.} \tn % Row Count 17 (+ 2) % Row 14 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{{\bf{git tag -f \textless{}tag\textgreater{} \textless{}commit id\textgreater{}}}} \tn % Row Count 18 (+ 1) % Row 15 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{Updates \textless{}tag\textgreater{} to be associated with the specified commit. Omitting \textless{}commit id\textgreater{} will associate the tag with where HEAD is on the current branch (usually the last commit).} \tn % Row Count 22 (+ 4) % Row 16 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{{\bf{git push \textless{}remote ref\textgreater{} \textless{}tag\textgreater{}}}} \tn % Row Count 23 (+ 1) % Row 17 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{Pushes the tag to the remote repo.} \tn % Row Count 24 (+ 1) % Row 18 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{{\bf{git push -{}-force \textless{}remote ref\textgreater{} \textless{}tag\textgreater{}}}} \tn % Row Count 25 (+ 1) % Row 19 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{Forces the push of the updated tag.} \tn % Row Count 26 (+ 1) % Row 20 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{{\bf{git push \textless{}remote ref\textgreater{} -{}-tags}}} \tn % Row Count 27 (+ 1) % Row 21 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{Pushes all the tags in the local repo to the remote repo.} \tn % Row Count 29 (+ 2) % Row 22 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{{\bf{git push \textless{}remote ref\textgreater{} :\textless{}tag\textgreater{}}}} \tn % Row Count 30 (+ 1) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{Tags (cont)}} \tn % Row 23 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{Tells GitHub to delete the tag after the colon.} \tn % Row Count 1 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{Remote Repos}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{{\bf{git remote -v}}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{Lists remote repos.} \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{{\bf{git remote add \textless{}remote ref\textgreater{} \textless{}remote url\textgreater{}}}} \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{Adds reference to a remote repo. \textless{}remote ref\textgreater{} can be anything, but is conventionally called origin.} \tn % Row Count 5 (+ 2) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{{\bf{git remote set-url \textless{}remote ref\textgreater{} \textless{}remote url\textgreater{}}}} \tn % Row Count 6 (+ 1) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{Updates the URL for the remote reference.} \tn % Row Count 7 (+ 1) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{{\bf{git remote show \textless{}remote ref\textgreater{}}}} \tn % Row Count 8 (+ 1) % Row 7 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{Returns info about the remote repo.} \tn % Row Count 9 (+ 1) % Row 8 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{{\bf{git clone \textless{}remote url\textgreater{}}}} \tn % Row Count 10 (+ 1) % Row 9 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{Clones the remote repo into the current directory inside a new folder that has the same name as the remote repo. (Git labels this remote as origin by default.)} \tn % Row Count 14 (+ 4) % Row 10 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{{\bf{git clone \textless{}remote url\textgreater{} \textless{}name\textgreater{}}}} \tn % Row Count 15 (+ 1) % Row 11 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{Clones the remote repo into the current directory in a new folder named \textless{}name\textgreater{}. (Git labels this remote as origin by default.)} \tn % Row Count 18 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{Fetching And Pulling}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{{\bf{git fetch \textless{}remote url\textgreater{}}}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{Git goes out to the remote repo and updates its local information about what's in the remote repo.} \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{{\bf{git fetch -p \textless{}remote url\textgreater{}}}} \tn % Row Count 4 (+ 1) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{Git looks for any dead branches and removes those references. The -p stands for prune.} \tn % Row Count 6 (+ 2) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{{\bf{git pull \textless{}remote url\textgreater{} \textless{}local branch name\textgreater{}}}} \tn % Row Count 7 (+ 1) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{Checks for changes in the remote repo, and pulls any changes to your local branch. It will open a commit window with a default commit message you can use. Will enter a merge state if there are conflicts.} \tn % Row Count 12 (+ 5) \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{{\emph{git pull is actually a 2-in-1 command: fetch then merge. It first fetches the updates from the remote repo, then merges those changes into the local repo.}}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}