\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{Gaëlle (gaelle3182)} \pdfinfo{ /Title (git-basics.pdf) /Creator (Cheatography) /Author (Gaëlle (gaelle3182)) /Subject (Git Basics 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}{058545} \definecolor{LightBackground}{HTML}{EFF7F3} \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 Basics Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{Gaëlle (gaelle3182)} via \textcolor{DarkBackground}{\uline{cheatography.com/26108/cs/7216/}}} \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}Gaëlle (gaelle3182) \\ \uline{cheatography.com/gaelle3182} \\ \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Published 28th April, 2016.\\ Updated 8th 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}{Configuration}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Configuration système (pour tous les utilisateurs et tous les dépôts)} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{`\$ git config -{}-system {[}parametre{]} {[}valeur{]}`} \tn % Row Count 3 (+ 1) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Configuration utilisateur spécifique} \tn % Row Count 4 (+ 1) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{`\$ git config -{}-global {[}parametre{]} {[}valeur{]}`} \tn % Row Count 5 (+ 1) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Configuration dépôt spécifique} \tn % Row Count 6 (+ 1) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{`\$ git config {[}parametre{]} {[}valeur{]}`} \tn % Row Count 7 (+ 1) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Vérifier la configuration} \tn % Row Count 8 (+ 1) % Row 7 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{`\$ git config -{}-list`} \tn % Row Count 9 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Chaque fichier écrase les valeurs du fichier précédent. Les valeurs dans la configuration du dépôt sont les plus spécifiques et priment donc sur les valeurs de la configuration utilisateur qui elles-mêmes l'emportent sur les valeurs de la configuration système.} \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}{Récupérer un dépot git}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Initialiser un nouveau dépôt} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{`\$ cd project\_directory` \{\{nl\}\} `\$ git init`} \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Cloner un dépôt existant} \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{`\$ git clone {[}url{]}`} \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Cloner un dépôt existant en changeant le nom du répertoire} \tn % Row Count 6 (+ 2) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{`\$ git clone {[}url{]} myproject`} \tn % Row Count 7 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Explorer l'historique}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Voir tout l'historique} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{`\$ git log`} \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Formater l'affichage des logs : affichage des logs sur une seule ligne} \tn % Row Count 4 (+ 2) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{`\$ git log -{}-pretty=oneline`} \tn % Row Count 5 (+ 1) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Limiter le nombre de logs affichés : avoir les 2 derniers logs} \tn % Row Count 7 (+ 2) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{`\$ git log -2`} \tn % Row Count 8 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.4931 cm} x{3.4839 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Options pour formater les logs}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{Option}} \{\{bb\}\} & {\bf{Description}} \{\{bb\}\} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} -p & Affiche les changements introduits dans chaque commit \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} -{}-stat & Affiche les statistiques des fichiers modifiés dans chaque commit \tn % Row Count 7 (+ 3) % Row 3 \SetRowColor{white} -{}-shortstat & Affiche des statistiques abrégées \tn % Row Count 9 (+ 2) % Row 4 \SetRowColor{LightBackground} -{}-name-only & Affiche juste la liste des fichiers modifiés \tn % Row Count 11 (+ 2) % Row 5 \SetRowColor{white} -{}-name-status & Affiche la liste des fichiers modifiés mais aussi ajoutés et supprimés \tn % Row Count 14 (+ 3) % Row 6 \SetRowColor{LightBackground} -{}-abbrev-commit & Affiche seulement les quelques premiers caractères du checksum de commit \tn % Row Count 17 (+ 3) % Row 7 \SetRowColor{white} -{}-relative-date & Affiche la date dans un format relative (ex depuis 2 jours) \tn % Row Count 20 (+ 3) % Row 8 \SetRowColor{LightBackground} -{}-graph & Affiche un graphe en ASCII des branches et des fusions en plus des informations de log \tn % Row Count 24 (+ 4) % Row 9 \SetRowColor{white} -{}-pretty & Affiche les logs dans un format alternatif. Plusieurs options possibles : oneline, short, full, fuller et format \tn % Row Count 28 (+ 4) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.44333 cm} x{3.53367 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Options pour limiter les logs affichés}} \tn % Row 0 \SetRowColor{LightBackground} -(n) & Afficher les n derniers commits \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} -{}-since,-{}-after & Afficher les commits faits depuis la date indiquée \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} -{}-until,-{}-before & Afficher les commits faits avant la date indiquée \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} -{}-author & Afficher les commits dont l'entrée author correspond à la chaîne indiquée \tn % Row Count 9 (+ 3) % Row 4 \SetRowColor{LightBackground} -{}-commiter & Afficher les commits dont l'entrée commiter correspond à la chaîne indiquée \tn % Row Count 12 (+ 3) % Row 5 \SetRowColor{white} -{}-grep & Afficher les commits dont le message contient la chaîne indiquée \tn % Row Count 15 (+ 3) % Row 6 \SetRowColor{LightBackground} -S & Afficher les commits qui ajoutent ou enlèvent du code comportant la chaîne indiquée \tn % Row Count 19 (+ 4) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Travailler avec le dépôt local}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Vérifier l'état des fichiers} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{`\$ git status`} \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Vérifier l'état des fichiers dans un format compact} \tn % Row Count 4 (+ 2) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{`\$ git status -s`} \tn % Row Count 5 (+ 1) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Suivre un nouveau fichier (versionner un nouveau fichier) ou indexer un fichier modifié} \tn % Row Count 7 (+ 2) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{`\$ git add {[}filename{]}`} \tn % Row Count 8 (+ 1) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Suivre tous les fichiers du répertoire de travail} \tn % Row Count 9 (+ 1) % Row 7 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{`\$ git add .`} \tn % Row Count 10 (+ 1) % Row 8 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Voir les changements entre le répertoire de travail et la zone d'indexation (staged area) = voir les changements qui ne sont pas indexés} \tn % Row Count 13 (+ 3) % Row 9 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{`\$ git diff`} \tn % Row Count 14 (+ 1) % Row 10 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Voir les changements entre la zone id'indexation et le dépôt = les changements qui n'ont pas été commité} \tn % Row Count 17 (+ 3) % Row 11 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{`\$ git diff -{}-changed`} \tn % Row Count 18 (+ 1) % Row 12 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Enregistrer les changements dans le dépôt} \tn % Row Count 19 (+ 1) % Row 13 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{`\$ git commit`} \tn % Row Count 20 (+ 1) % Row 14 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{`\$ git commit -m "{[}message{]}"`} \tn % Row Count 21 (+ 1) % Row 15 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Enregister les changements dans le dépôt sans passe la par la zone d'indexation} \tn % Row Count 23 (+ 2) % Row 16 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{`\$ git commit -a -m "{[}message{]}"`} \tn % Row Count 24 (+ 1) % Row 17 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Ne plus versionner un fichier et le supprimer du répertoire} \tn % Row Count 26 (+ 2) % Row 18 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{`git rm {[}filename{]}`} \tn % Row Count 27 (+ 1) % Row 19 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Ne plus versionner un fichier sans le supprimer du répertoire} \tn % Row Count 29 (+ 2) % Row 20 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{`\$ git rm -{}-cached {[}filename{]}`} \tn % Row Count 30 (+ 1) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Travailler avec le dépôt local (cont)}} \tn % Row 21 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Renommer un fichier} \tn % Row Count 1 (+ 1) % Row 22 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{`\$ git mv {[}file\_from{]} {[}file\_to{]}`} \tn % Row Count 2 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Revenir en arrière}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Refaire un commit (pour changer le message ou ajouter des fichiers oubliés)} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{`\$ git -{}-amend`} \tn % Row Count 3 (+ 1) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Enlever un fichier de la zone d'indexation} \tn % Row Count 4 (+ 1) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{`\$ git reset HEAD {[}filename{]}`} \tn % Row Count 5 (+ 1) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Supprimer les derniers changements d'un fichier (revenir au fichier comme il était au dernier commit)} \tn % Row Count 8 (+ 3) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{`\$ git checkout -{}- {[}filename{]}`} \tn % Row Count 9 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Travailler avec les dépôts distants}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Lister les noms des dépôts distants référencés localement} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{`\$ git remote`} \tn % Row Count 3 (+ 1) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Lister les dépôts distants avec leur url} \tn % Row Count 4 (+ 1) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{`\$ git remote -v`} \tn % Row Count 5 (+ 1) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Ajouter/Référencer un dépôt distant} \tn % Row Count 6 (+ 1) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{`\$ git remote add {[}shortname{]} {[}url{]}`} \tn % Row Count 7 (+ 1) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Récupérer les informations d'un dépôt distant} \tn % Row Count 8 (+ 1) % Row 7 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{`\$ git fetch {[}shortname{]}`} \tn % Row Count 9 (+ 1) % Row 8 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Récupérer les informations de tous les dépôts distants} \tn % Row Count 11 (+ 2) % Row 9 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{`\$ git fetch -{}-all`} \tn % Row Count 12 (+ 1) % Row 10 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Lister les informations du dépôt local concernant l'état entre banches locales/branches distantes} \tn % Row Count 14 (+ 2) % Row 11 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{`\$ git branch -vv`} \tn % Row Count 15 (+ 1) % Row 12 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Récupérer les données d'un dépôt distant et les fusionner au dépôt local} \tn % Row Count 17 (+ 2) % Row 13 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{`\$ git pull`} \tn % Row Count 18 (+ 1) % Row 14 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Envoyer données sur un dépôt distant (pour lequel on a les droits d'écriture)} \tn % Row Count 20 (+ 2) % Row 15 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{`\$ git push {[}shortname{]} {[}branchname{]}`} \tn % Row Count 21 (+ 1) % Row 16 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Inspecter un dépôt distant} \tn % Row Count 22 (+ 1) % Row 17 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{`\$ git remote show {[}shortname{]}`} \tn % Row Count 23 (+ 1) % Row 18 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Renommer la référence (le shortname) d'un dépôt distant} \tn % Row Count 25 (+ 2) % Row 19 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{`\$ git remote rename {[}current shortname{]} {[}new shortname{]}`} \tn % Row Count 27 (+ 2) % Row 20 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Enlever/Déréférencer un dépôt distant} \tn % Row Count 28 (+ 1) % Row 21 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{`\$ git remote rm {[}shortname{]}`} \tn % Row Count 29 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{La commande `fetch` récupère les informations du serveur distant et répercute les changements sans toucher aux branches locales. Il faut ensuite faire des fusions ou créer des branches locales pour pouvoir éditer les branches distantes qui n'existent pas localement. \newline La commande `pull` est en quelque sorte une commande magique qui fait un `fetch` suivi d'un `merge` : `pull` regarde quel branche sur quel serveur est suivie par la branche locale puis récupère et fusionne les changements.} \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}{Les tags}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Lister les tags} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{`\$ git tag`} \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Lister les tags selon un filtre} \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{`\$ git tag -l {[}pattern{]}`} \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Voir les informations à propos d'un tag} \tn % Row Count 5 (+ 1) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{`\$ git show {[}tagname{]}`} \tn % Row Count 6 (+ 1) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Créer un tag annoté} \tn % Row Count 7 (+ 1) % Row 7 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{git tag -a {[}tagname{]} -m "{[}message{]}"`} \tn % Row Count 8 (+ 1) % Row 8 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Créer un tag simple} \tn % Row Count 9 (+ 1) % Row 9 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{`\$ git tag {[}tagname{]}`} \tn % Row Count 10 (+ 1) % Row 10 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Taguer des commit précédents} \tn % Row Count 11 (+ 1) % Row 11 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{`\$ git tag -a {[}tagname{]} {[}checksum commit{]}`} \tn % Row Count 12 (+ 1) % Row 12 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Transférer un tag sur un dépôt distant} \tn % Row Count 13 (+ 1) % Row 13 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{`\$ git push {[}shortname{]} {[}tagname{]}`} \tn % Row Count 14 (+ 1) % Row 14 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Transférer tous les tags sur un dépôt distant} \tn % Row Count 15 (+ 1) % Row 15 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{`\$ git push {[}shortname{]} -{}-tags`} \tn % Row Count 16 (+ 1) % Row 16 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Récupérer les fichiers correspondant à un tag =\textgreater{} création d'une branche à partir de ce tag} \tn % Row Count 18 (+ 2) % Row 17 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{`\$ git checkout -b {[}branchname{]} {[}tagname{]}`} \tn % Row Count 19 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Les branches}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Lister les branches} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{`\$ git branch`} \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Lister les branches qui sont fusionnées avec la branche courante} \tn % Row Count 4 (+ 2) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{`\$ git branch -{}-merged`} \tn % Row Count 5 (+ 1) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Lister les branches non fusionnées} \tn % Row Count 6 (+ 1) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{`\$ git branch -{}-no-merged`} \tn % Row Count 7 (+ 1) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Créer une branche} \tn % Row Count 8 (+ 1) % Row 7 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{`\$ git branch {[}branchname{]}`} \tn % Row Count 9 (+ 1) % Row 8 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Voir sur quelle branche se situe le pointeur de branche (HEAD)} \tn % Row Count 11 (+ 2) % Row 9 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{`git log -{}-oneline -{}-decorate`} \tn % Row Count 12 (+ 1) % Row 10 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Changer de branche} \tn % Row Count 13 (+ 1) % Row 11 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{`\$ git checkout {[}branchname{]}`} \tn % Row Count 14 (+ 1) % Row 12 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Créer une branche et se positionner dessus} \tn % Row Count 15 (+ 1) % Row 13 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{`\$ git checkout -b {[}branchname{]}`} \tn % Row Count 16 (+ 1) % Row 14 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Fusionner des branches (à partir de la branche sur laquelle on est)} \tn % Row Count 18 (+ 2) % Row 15 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{`\$ git merge {[}branchname{]}`} \tn % Row Count 19 (+ 1) % Row 16 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Supprimer une branche} \tn % Row Count 20 (+ 1) % Row 17 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{`\$ git branch -d {[}branchname{]}`} \tn % Row Count 21 (+ 1) % Row 18 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Supprimer une branche diatante} \tn % Row Count 22 (+ 1) % Row 19 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{`\$ git push {[}shortname{]} -{}-delete {[}branchname{]}`} \tn % Row Count 23 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Ignorer des fichiers}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Pour empêcher git de suivre automatiquement des fichiers ou même de montrer les fichiers non suivis, il faut éditer un fichier nommé {\bf{.gitignore}} dans le dépôt. Ce fichier liste un ensemble de motifs qui permettent de cibler les fichiers à exclure. \newline % Row Count 6 (+ 6) En général ce sont des fichiers générés automatiquement comme des fichiers de log ou provenant du système de build. \newline % Row Count 9 (+ 3) Les règles pour construire ce fichier sont : \newline % Row Count 10 (+ 1) \{\{fa-angle-right\}\} les lignes vides ou commençant par \# sont ignorés \newline % Row Count 12 (+ 2) \{\{fa-angle-right\}\} les glob patterns standards sont utilisables \newline % Row Count 14 (+ 2) \{\{fa-angle-right\}\} un motif qui commence par un slash (/) empêche la récursivité \newline % Row Count 16 (+ 2) \{\{fa-angle-right\}\} un motif qui se termine par un slash (/) indique un répertoire \newline % Row Count 18 (+ 2) \{\{fa-angle-right\}\} un motif qui commence par un point d'exclamation (!) annule le motif \newline % Row Count 20 (+ 2) Quelques exemples : \newline % Row Count 21 (+ 1) `\# ignorer les fichiers .log sauf le fichier` \newline % Row Count 22 (+ 1) `\# lib.log` \newline % Row Count 23 (+ 1) ` *.log` \newline % Row Count 24 (+ 1) `!lib.log` \newline % Row Count 25 (+ 1) `\# ignorer les fichiers .tmp dans le dossier` \newline % Row Count 26 (+ 1) `\# racine mais pas dans les sous-dossiers` \newline % Row Count 27 (+ 1) `/*.log` \newline % Row Count 28 (+ 1) Recommandations pour construire un bon fichier {\bf{.gitignore}} : \seqsplit{https://github.com/github/gitignore}% Row Count 30 (+ 2) } \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}{Sources}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{\{\{fa-book\}\} Livre Git Pro (fr) : \seqsplit{https://git-scm.com/book/fr/v2}} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{\{\{fa-book\}\} Livre Git Pro (en) : \seqsplit{https://git-scm.com/book/en/v2}} \tn % Row Count 4 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}