formation-git/git.tex

135 lines
3.2 KiB
TeX
Raw Permalink Normal View History

2018-09-23 21:27:56 +00:00
\documentclass{beamer}
\usetheme{metropolis} % Use metropolis theme
\usepackage{minted}
\title{Formation Git}
\date{\today}
\author{Klafyvel}
\institute{Rézo Metz}
\begin{document}
\maketitle
\section{Git : la babibase}
\begin{frame}{Pourquoi ?}
\begin{itemize}
\item Partager le même code ;
\item Travailler sur une copie indépendante sans impacter le travail
des autres ;
\item Propager ses modifications ou importer celles de ses
collègues ;
\item Revenir sur une version antérieure du code ;
\item Faire évoluer simultanément lapplication dans des directions
différentes ;
\item Sappuyer sur un système de sauvegarde du code.
\end{itemize}
\end{frame}
\begin{frame}[fragile]{Installation}
Sous Linux :
\begin{minted}{bash}
sudo apt install git
\end{minted}
Sous Windows :
https://gitforwindows.org/
\end{frame}
\begin{frame}[fragile]{Configuration de git}
\begin{minted}{bash}
git config --global --edit
\end{minted}
\end{frame}
\begin{frame}[fragile]{Créons un projet}
\begin{minted}{bash}
git init
\end{minted}
Ou si vous récupérez le projet de quelqu'un d'autre
\begin{minted}{bash}
git clone <url>
\end{minted}
\end{frame}
\begin{frame}[fragile]{Principe général}
\begin{itemize}
\item<1-> Une modification = Un 'commit'
\item<2-> Prendre le code ici : https://bit.ly/2zpTX0u ou le recopier dans le fichier 'code.py':
\begin{minted}{python}
def say(sentence):
print("I'm told to say :", end="")
print(sentence)
if __name__=='__main__':
say("Hello !")
\end{minted}
\item<3-> Ajouter le fichier
\begin{minted}{bash}
git add fichier
\end{minted}
\end{itemize}
\end{frame}
\begin{frame}[fragile]{Principe général}
\begin{itemize}
\item<1-> Voir l'état de notre projet
\begin{minted}{bash}
git status
\end{minted}
\item<2-> Voir nos modifications
\begin{minted}{bash}
git diff [<fichier>]
\end{minted}
\item<3-> Commiter
\begin{minted}{bash}
git commit fichier
\end{minted}
\end{itemize}
\end{frame}
\begin{frame}{Que sait-on faire ?}
Avoir un historique de nos modifications.
\begin{figure}
\centering
\includegraphics[width=0.7\linewidth]{commit}
\caption{}
\label{fig:commit}
\end{figure}
\end{frame}
\section{Gitlab}
\begin{frame}{Le Gitlab du Rézo}
Connectez-vous ici : https://gitlab.rezometz.org/
\end{frame}
\begin{frame}{Le Gitlab du Rézo}
\begin{figure}
\centering
\includegraphics[width=\linewidth]{gitlab}
\caption{le GitLab du Rézo}
\label{fig:gitlab}
\end{figure}
\end{frame}
\begin{frame}[fragile]{Le Gitlab du Rézo}
\begin{itemize}
\item<1-> Créez un nouveau projet
\item<2-> Récupérez l'URL de clonage
\begin{figure}
\centering
\includegraphics[width=0.7\linewidth]{url_gitlab}
\caption{URL de clonage}
\label{fig:urlgitlab}
\end{figure}
\item<3-> Enregistrez cet URL comme étant l'origine de votre projet
\begin{minted}{bash}
git remote add origin <url>
\end{minted}
\item<4-> Envoyez vos modifications
\begin{minted}{bash}
git push
\end{minted}
\item<5-> Récupérer les modifications distantes
\begin{minted}{bash}
git pull
\end{minted}
\end{itemize}
\end{frame}
\end{document}