\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{babobba} \pdfinfo{ /Title (git-annex.pdf) /Creator (Cheatography) /Author (babobba) /Subject (git-annex 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}{0D62A3} \definecolor{LightBackground}{HTML}{EFF5F9} \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-annex Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{babobba} via \textcolor{DarkBackground}{\uline{cheatography.com/20826/cs/3715/}}} \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}babobba \\ \uline{cheatography.com/babobba} \\ \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 12th May, 2016.\\ 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} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Create a new git/git-annex repo}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{`mkdir \textasciitilde{}/aNewRepo \&\& cd \textasciitilde{}/aNewRepo` \newline % Row Count 1 (+ 1) \{\{fa-git\}\}Standard git repo init \newline % Row Count 2 (+ 1) `git init .` \newline % Row Count 3 (+ 1) \{\{fa-power-off\}\}Create \{\{link="http://git-annex.branchable.com/"\}\}git-annex\{\{/link\}\}\textasciicircum{}1\textasciicircum{} repo \newline % Row Count 5 (+ 2) `git-annex init . "R2D2-aNewRepo"`% Row Count 6 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{\textasciicircum{}1\textasciicircum{} \seqsplit{http://git-annex.branchable.com/} \newline \{\{fa-info\}\}Suggest `location-repo` name scheme for multi git repo setups \newline ie. ` R2D2-aNewRepo` \newline \{\{fa-info\}\}Suggest `location-repo-annex` name scheme for multi `git-annex` repo setups \newline ie. `R2D2-aNewRepo-Annex`} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{\{\{fa-cog\}\}Customizations}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{\{\{fa-git\}\}Override global git config (optional) \newline % Row Count 1 (+ 1) `cd \textasciitilde{}/aNewRepo` \newline % Row Count 2 (+ 1) `git config user.name name` \newline % Row Count 3 (+ 1) `git config user.email email` \newline % Row Count 4 (+ 1) \# Speed up large commits at memory cost\textasciicircum{}1\textasciicircum{} \newline % Row Count 5 (+ 1) `git config annex.queuesize 1024000` \newline % Row Count 6 (+ 1) \# Add metadata \{a,c,m\}time at first commit\textasciicircum{}2\textasciicircum{} \newline % Row Count 7 (+ 1) `git config annex.genmetadata true` \newline % Row Count 8 (+ 1) \# Change how git-annex looksup files\textasciicircum{}3\textasciicircum{} \newline % Row Count 9 (+ 1) `git config annex.backends \{MD5E,WORM,..\}`% Row Count 10 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{\textasciicircum{}1\textasciicircum{} Default is 102400 \newline \textasciicircum{}2\textasciicircum{} Filesystem metadata can only be added during initial commit \newline \textasciicircum{}3\textasciicircum{} Lots of other hashes to include SHA1, {\bf{SHA256E}}(default). \newline \{\{fa-book\}\}MD5E is useful for correlation against legacy media. \newline \{\{fa-file-video-o\}\}WORM is useful for fast imports and media files prone to changing metadata.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Indirect/Direct Mode}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{\{\{fa-warning\}\}Use git-annex in direct mode \newline % Row Count 1 (+ 1) `git-annex direct` \newline % Row Count 2 (+ 1) \# Use git-annex in indirect mode \newline % Row Count 3 (+ 1) `git-annex indirect`% Row Count 4 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Default is {\bf{indirect}} mode. \newline \{\{fa-windows\}\}Direct mode is used when a filesystem can't support sym links like FAT32 or when operating in a Windows OS. \newline \{\{fa-linux\}\}\{\{fa-apple\}\}NTFS/exFAT can still be used. \newline \{\{fa-apple\}\}\{\{fa-question\}\} OSX might cover FAT32 deficiencies and work in indirect mode. \newline \{\{fa-info\}\}git-annex repos can be switched between direct and indirect at will. \newline \{\{fa-warning\}\}Operating in direct mode takes away some of git-annex's safety in ensuring the availability of a file.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Helpful Aliases}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{`alias ga='git-annex'` \newline % Row Count 1 (+ 1) `alias gaa='git-annex add'` \newline % Row Count 2 (+ 1) `alias gas='git-annex sync'` \newline % Row Count 3 (+ 1) `alias gag='git-annex get'` \newline % Row Count 4 (+ 1) `alias gad='git-annex drop'` \newline % Row Count 5 (+ 1) `alias gal=git-annex unlock'` \newline % Row Count 6 (+ 1) `alias gau='git-annex unused'` \newline % Row Count 7 (+ 1) `alias gam='git-annex move'` \newline % Row Count 8 (+ 1) `alias gac='git-annex copy'` \newline % Row Count 9 (+ 1) `alias gaf='git-annex fsck'` \newline % Row Count 10 (+ 1) `alias gai='git-annex info'` \newline % Row Count 11 (+ 1) `alias gaw='git-annex whereis'`% Row Count 12 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{File Management (indirect mode)}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{\# Use `git-annex` instead of `git`\textasciicircum{}1\textasciicircum{} \newline % Row Count 1 (+ 1) `git-annex add afile` \newline % Row Count 2 (+ 1) \{\{fa-unlock\}\}Unlock a file for editing \newline % Row Count 3 (+ 1) `git-annex unlock afile \&\& echo ' ' \textgreater{}\textgreater{} afile` \newline % Row Count 4 (+ 1) `git mv afile bfile` \newline % Row Count 5 (+ 1) `git rm bfile` \newline % Row Count 6 (+ 1) `git commit -a -m "commit msg"`% Row Count 7 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{\textasciicircum{}1\textasciicircum{} Faster for large binary files} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{File Management (direct mode)}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{\# git add/rm/mv will {\bf{not}} work in direct mode \newline % Row Count 1 (+ 1) `git-annex add afile` \newline % Row Count 2 (+ 1) `mv afile bfile` \newline % Row Count 3 (+ 1) `rm bfile` \newline % Row Count 4 (+ 1) \# git commit will {\bf{not}} work in direct mode \newline % Row Count 5 (+ 1) \# Use git-annex sync in lieu of git commit \newline % Row Count 6 (+ 1) `git-annex sync -m "commit msg"` \newline % Row Count 7 (+ 1) \{\{fa-step-backward\}\}Undo change as `git revert` will not work\textasciicircum{}1\textasciicircum{} \newline % Row Count 9 (+ 2) `git-annex undo afile`% Row Count 10 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{\textasciicircum{}1\textasciicircum{} Use with `-{}-depth` to revert to earlier versions of file \newline \{\{fa-exclamation\}\} Use of `git-annex sync`` is crucial in direct mode} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Web/Torrent Sources}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{alias ga='git-annex' \newline % Row Count 1 (+ 1) \{\{fa-cloud-download\}\}Use git-annex to add afile from the web\textasciicircum{}1\textasciicircum{} \newline % Row Count 3 (+ 2) `ga addurl http://fqdn/afile -{}-file afile` \newline % Row Count 4 (+ 1) \# Add an URL to a file after the fact \newline % Row Count 5 (+ 1) `git-annex addurl afile http://fqdn/afile` \newline % Row Count 6 (+ 1) \# Download/Add the contents of a torrent \newline % Row Count 7 (+ 1) `ga addurl http://fqdn/a.torrent` \newline % Row Count 8 (+ 1) \{\{fa-magnet\}\} Add the contents of magnet link \newline % Row Count 9 (+ 1) `ga addurl magnet?....`% Row Count 10 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{\textasciicircum{}1\textasciicircum{} If -{}-file is not specified, the filename is appended to the fqdn. {\bf{Not usually desired.}}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{\{\{fa-hdd-o\}\}Adding remotes}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{`cd /mnt/usb` \newline % Row Count 1 (+ 1) \{\{fa-git\}\}Standard git clone \newline % Row Count 2 (+ 1) `git clone \textasciitilde{}/aNewRepo` \newline % Row Count 3 (+ 1) `cd aNewRepo` \newline % Row Count 4 (+ 1) \# Init git-annex with a unique name \newline % Row Count 5 (+ 1) `git-annex init "XWING-aNewRepo"` \newline % Row Count 6 (+ 1) \{\{fa-git\}\}Standard git remote config in new USB repo \newline % Row Count 8 (+ 2) `git remote add R2D2 \textasciitilde{}/aNewRepo` \newline % Row Count 9 (+ 1) \{\{fa-git\}\}Std git remote config from origin repo \newline % Row Count 10 (+ 1) `cd \textasciitilde{}/aNewRepo` \newline % Row Count 11 (+ 1) `git remote add XWING /mnt/usb/aNewRepo`% Row Count 12 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{cp/mv/drop/find on remotes}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{`cd \textasciitilde{}/aNewRepo` \newline % Row Count 1 (+ 1) \{\{fa-copy\}\}Copy from this repo {\bf{to}} a remote \newline % Row Count 2 (+ 1) `git-annex copy afile -{}-to XWING-aNewRepo` \newline % Row Count 3 (+ 1) \# Moves a file from this repo {\bf{to}} a remote \newline % Row Count 4 (+ 1) `git-annex move afile -t XWING-aNewRepo` \newline % Row Count 5 (+ 1) \{\{fa-copy\}\}Copy to this repo {\bf{from}} a remote \newline % Row Count 6 (+ 1) `cd /mnt/usb/aNewRepo` \newline % Row Count 7 (+ 1) `git-annex move bfile -{}-from R2D2-aNewRepo` \newline % Row Count 8 (+ 1) \#Removes file from current repo {\bf{only}}\textasciicircum{}2\textasciicircum{} \newline % Row Count 9 (+ 1) `git-annex drop afile` \newline % Row Count 10 (+ 1) \{\{fa-search\}\}Find who has a copy of a file \newline % Row Count 11 (+ 1) `git-annex whereis afile`% Row Count 12 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{\textasciicircum{}1\textasciicircum{} Checks against `numcopies` \newline \textasciicircum{}2\textasciicircum{}Checks against `numcopies`. Use for space management.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Sync Repos}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{\{\{fa-warning\}\}Sync repo metadata - {\bf{No content}} \newline % Row Count 1 (+ 1) `cd /mnt/usb/aNewRepo` \newline % Row Count 2 (+ 1) `git-annex sync R2D2-aNewRepo` \newline % Row Count 3 (+ 1) \{\{fa-exchange\}\}Sync metadata {\bf{and}} content \newline % Row Count 4 (+ 1) `git-annex sync R2D2-aNewRepo -{}-content`% Row Count 5 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Special Remotes (To Do)}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{\{\{fa-archive\}\}\{\{link="https://bup.github.io/"\}\}bup\{\{/link\}\}\textasciicircum{}1\textasciicircum{}% Row Count 2 (+ 2) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{\textasciicircum{}1\textasciicircum{} https://bup.github.io/} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Extra}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{\# Tell git-annex to not rely on a repo\textasciicircum{}1\textasciicircum{} \newline % Row Count 1 (+ 1) `git-annex untrust C3PO-aNewRepo` \newline % Row Count 2 (+ 1) \{\{fa-ban\}\}Tell a repo is no longer available \newline % Row Count 3 (+ 1) `git-annex dead JABBA-aNewRepo`% Row Count 4 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{\textasciicircum{}1\textasciicircum{} We all know C3PO is flaky. git-annex by default only {\bf{semi-trusts}} a repo. You can use this with remotes using direct mode, cloud storage, etc.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{\{\{fa-wrench\}\}Repo maintenance}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{\# Show git-annex information \newline % Row Count 1 (+ 1) `git-annex info` \newline % Row Count 2 (+ 1) \# Fsck git-annex repo \newline % Row Count 3 (+ 1) `git-annex fsck` \newline % Row Count 4 (+ 1) \{\{fa-trash\}\}Do git garbage collection \newline % Row Count 5 (+ 1) `git gc` \newline % Row Count 6 (+ 1) \# Show unused objects in the repo\textasciicircum{}1\textasciicircum{} \newline % Row Count 7 (+ 1) `git-annex unused`% Row Count 8 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{\textasciicircum{}1\textasciicircum{} These are objects that have not been dropped, but removed from a branch. Might want for archival reasons. Best to copy to an archival remote like bup.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Tags/Branches/Views {[}To Do{]}}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Add git-annex to existing git repos {[}To Do{]}}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}