\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{Happy Python} \pdfinfo{ /Title (happy-python-git-.pdf) /Creator (Cheatography) /Author (Happy Python) /Subject (Happy Python Git-шпаргралка 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}{7579E7} \definecolor{LightBackground}{HTML}{F6F6FD} \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{Happy Python Git-шпаргралка Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{Happy Python} via \textcolor{DarkBackground}{\uline{cheatography.com/170090/cs/35553/}}} \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}Happy Python \\ \uline{cheatography.com/happy-python} \\ \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 18th November, 2022.\\ 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*}{3} \begin{tabularx}{5.377cm}{x{1.8308 cm} x{2.2885 cm} p{0.4577 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{5.377cm}}{\bf\textcolor{white}{Базовая конфигурация}} \tn % Row 0 \SetRowColor{LightBackground} \seqsplit{Настройка} git & {\bf{git config -{}-global user.name "ваше имя"}} & \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} & {\bf{git config -{}-global user.email "email@hp.com"}} & \tn % Row Count 6 (+ 3) % Row 2 \SetRowColor{LightBackground} \seqsplit{Создание} \seqsplit{локального} \seqsplit{репозитория} git & {\bf{git init (directory)}} & \tn % Row Count 10 (+ 4) % Row 3 \SetRowColor{white} \seqsplit{Клонирование} \seqsplit{удаленного} \seqsplit{репозитория} & {\bf{git clone (url)}} & \tn % Row Count 15 (+ 5) \hhline{>{\arrayrulecolor{DarkBackground}}---} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.64772 cm} x{1.46464 cm} x{1.46464 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{5.377cm}}{\bf\textcolor{white}{Файлы проекта}} \tn % Row 0 \SetRowColor{LightBackground} \seqsplit{Добавить} файл в \seqsplit{stage-зону} & {\bf{git add (file)}} & \tn % Row Count 4 (+ 4) % Row 1 \SetRowColor{white} & {\bf{git add .}} & {\emph{Добавить все файлы}} \tn % Row Count 7 (+ 3) % Row 2 \SetRowColor{LightBackground} \seqsplit{Удаление} файла из \seqsplit{stage-зоны} & {\bf{git reset (file)}} & \tn % Row Count 11 (+ 4) % Row 3 \SetRowColor{white} \seqsplit{Перемещение} файла & {\bf{git mv (current path) (new path)}} & \tn % Row Count 14 (+ 3) % Row 4 \SetRowColor{LightBackground} \seqsplit{Удаление} файла & {\bf{git rm (file)}} & \tn % Row Count 16 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}---} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.78503 cm} x{1.8308 cm} x{0.96117 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{5.377cm}}{\bf\textcolor{white}{Просмотр изменений}} \tn % Row 0 \SetRowColor{LightBackground} \seqsplit{Изменения} в файлах & {\bf{git diff}} & {\emph{unstaged файлы}} \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} & {\bf{git diff -{}-staged}} & {\emph{staged файлы}} \tn % Row Count 6 (+ 3) % Row 2 \SetRowColor{LightBackground} \seqsplit{Различия} между \seqsplit{коммитами} & {\bf{git diff (commit id 01) (commit id 02)}} & \tn % Row Count 10 (+ 4) % Row 3 \SetRowColor{white} \seqsplit{Различия} между ветками & {\bf{git diff branch1..branch2}} & \tn % Row Count 13 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}---} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.33427 cm} x{1.78503 cm} p{0.4577 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{5.377cm}}{\bf\textcolor{white}{Временное хранилище (stash)}} \tn % Row 0 \SetRowColor{LightBackground} Работа с \seqsplit{хранилищем} (stash) & git stash & \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} & git stash save "(message)" & \tn % Row Count 5 (+ 2) % Row 2 \SetRowColor{LightBackground} Список стэшей & git stash list & \tn % Row Count 7 (+ 2) % Row 3 \SetRowColor{white} Применить хранилище (stash) & git stash apply (stash id) & \tn % Row Count 10 (+ 3) % Row 4 \SetRowColor{LightBackground} & git stash apply stash@\{0\} & \tn % Row Count 12 (+ 2) % Row 5 \SetRowColor{white} Удалить хранилище (stash) & git stash drop (stash id) & \tn % Row Count 15 (+ 3) % Row 6 \SetRowColor{LightBackground} Удалить все хранилища (stash) & git stash clear & \tn % Row Count 18 (+ 3) % Row 7 \SetRowColor{white} Удалить после \seqsplit{применения} хранилища & git stash pop (stash id) & \tn % Row Count 22 (+ 4) % Row 8 \SetRowColor{LightBackground} Показать изменения в хранилище (stash) & git stash show (stash id) & \tn % Row Count 26 (+ 4) \hhline{>{\arrayrulecolor{DarkBackground}}---} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.69349 cm} x{1.19002 cm} x{1.69349 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{5.377cm}}{\bf\textcolor{white}{Коммиты}} \tn % Row 0 \SetRowColor{LightBackground} Commit \seqsplit{изменений} & git commit -m \seqsplit{"(message)"} & \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} & git commit -a -m \seqsplit{"(message)"} & \seqsplit{добавить} все \seqsplit{изменения} \tn % Row Count 6 (+ 3) % Row 2 \SetRowColor{LightBackground} & git commit -am "message" & \seqsplit{добавить} все \seqsplit{изменения} \tn % Row Count 9 (+ 3) % Row 3 \SetRowColor{white} \seqsplit{Переход} к \seqsplit{прошлому} commit & git checkout (commit id) & \tn % Row Count 12 (+ 3) % Row 4 \SetRowColor{LightBackground} Отмена \seqsplit{коммита} & git revert (commit id) & \tn % Row Count 15 (+ 3) % Row 5 \SetRowColor{white} \seqsplit{Удаление} \seqsplit{коммита} & git reset (commit id) & \tn % Row Count 18 (+ 3) % Row 6 \SetRowColor{LightBackground} & git reset -{}-hard (commit id) & \tn % Row Count 21 (+ 3) % Row 7 \SetRowColor{white} \seqsplit{История} \seqsplit{коммитов} git & git log & \tn % Row Count 24 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}---} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.73926 cm} x{1.09848 cm} x{1.73926 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{5.377cm}}{\bf\textcolor{white}{Ветки}} \tn % Row 0 \SetRowColor{LightBackground} \seqsplit{Показать} ветки & git branch & \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} & git branch -a & \seqsplit{Показать} все ветки (local \& remote) \tn % Row Count 6 (+ 4) % Row 2 \SetRowColor{LightBackground} & git branch -r & \seqsplit{показать} только \seqsplit{удаленные} (remote) ветки \tn % Row Count 11 (+ 5) % Row 3 \SetRowColor{white} & git branch -v & \seqsplit{Показать} ветки с \seqsplit{последним} commit \tn % Row Count 15 (+ 4) % Row 4 \SetRowColor{LightBackground} \seqsplit{Создание} ветки git & git branch (branch) & \tn % Row Count 18 (+ 3) % Row 5 \SetRowColor{white} & git checkout -b (branch) & Сразу \seqsplit{перейдет} на эту ветку \tn % Row Count 22 (+ 4) % Row 6 \SetRowColor{LightBackground} Переход на другую ветку & git checkout (branch) & \tn % Row Count 25 (+ 3) % Row 7 \SetRowColor{white} Удалить ветку & git branch -d (branch) & \tn % Row Count 28 (+ 3) % Row 8 \SetRowColor{LightBackground} & git branch -D (branch) & Force Delete \tn % Row Count 31 (+ 3) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{x{1.73926 cm} x{1.09848 cm} x{1.73926 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{5.377cm}}{\bf\textcolor{white}{Ветки (cont)}} \tn % Row 9 \SetRowColor{LightBackground} \seqsplit{Различия} межу двумя ветками & git diff \seqsplit{branch1..branch2} & \tn % Row Count 4 (+ 4) % Row 10 \SetRowColor{white} \seqsplit{Подробное} \seqsplit{описание} ветки & git branch -vv & \tn % Row Count 8 (+ 4) \hhline{>{\arrayrulecolor{DarkBackground}}---} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.87657 cm} x{0.82386 cm} x{1.87657 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{5.377cm}}{\bf\textcolor{white}{Слияние (Merge)}} \tn % Row 0 \SetRowColor{LightBackground} Слияние веток (Merge a branch) & git merge & \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} & git merge -{}-no-ff & без Fast Forward \tn % Row Count 6 (+ 3) % Row 2 \SetRowColor{LightBackground} & git merge -{}-squash & \seqsplit{Соединить} коммиты ветки в один \tn % Row Count 10 (+ 4) % Row 3 \SetRowColor{white} \seqsplit{Перебазирование} (rebase) ветки & git rebase & \tn % Row Count 14 (+ 4) \hhline{>{\arrayrulecolor{DarkBackground}}---} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.87657 cm} x{1.8308 cm} x{0.86963 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{5.377cm}}{\bf\textcolor{white}{Удаленный репозиторий (Remote)}} \tn % Row 0 \SetRowColor{LightBackground} \seqsplit{Добавить} \seqsplit{удаленный} \seqsplit{репозиторий} & git remote add (remote name) (url) & \tn % Row Count 4 (+ 4) % Row 1 \SetRowColor{white} \seqsplit{Показать} \seqsplit{удаленные} \seqsplit{репозитории} & git remote & \tn % Row Count 8 (+ 4) % Row 2 \SetRowColor{LightBackground} & git remote -v & \seqsplit{покажет} URL \tn % Row Count 11 (+ 3) % Row 3 \SetRowColor{white} \seqsplit{Удаление} \seqsplit{удаленного} \seqsplit{репозитория} & git remote remove (remote name) & \tn % Row Count 15 (+ 4) % Row 4 \SetRowColor{LightBackground} \seqsplit{Переименование} \seqsplit{удаленного} \seqsplit{репозитория} & git remote rename (old name) (new name) & \tn % Row Count 20 (+ 5) % Row 5 \SetRowColor{white} \seqsplit{Получение} \seqsplit{изменений} из \seqsplit{удаленного} \seqsplit{репозитория} & git fetch (remote name) & \tn % Row Count 26 (+ 6) % Row 6 \SetRowColor{LightBackground} \seqsplit{Получение} \seqsplit{изменений} из \seqsplit{определенной} ветви & git fetch (remote name) (branch) & \tn % Row Count 31 (+ 5) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{x{1.87657 cm} x{1.8308 cm} x{0.86963 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{5.377cm}}{\bf\textcolor{white}{Удаленный репозиторий (Remote) (cont)}} \tn % Row 7 \SetRowColor{LightBackground} \seqsplit{Извлечение} \seqsplit{изменений} из \seqsplit{удаленного} \seqsplit{репозитория} в \seqsplit{локальный} проект & git pull (remote name) (branch) & \tn % Row Count 8 (+ 8) % Row 8 \SetRowColor{white} \seqsplit{Отправка} \seqsplit{изменений} в \seqsplit{удаленный} \seqsplit{репозиторий} & git push (remote name) & \tn % Row Count 13 (+ 5) % Row 9 \SetRowColor{LightBackground} \seqsplit{Отправка} \seqsplit{изменений} в \seqsplit{определенную} ветвь & git push (remote name) (branch) & \tn % Row Count 18 (+ 5) \hhline{>{\arrayrulecolor{DarkBackground}}---} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}