Commit efa87d5c authored by Mihai's avatar Mihai

Moved common parts to shared and started basics update

parent a9fc77c5
...@@ -2,13 +2,13 @@ ...@@ -2,13 +2,13 @@
\input{../shared/shared.tex} \input{../shared/shared.tex}
\author{Jeroen F.J. Laros} \author{}
\title{\courseTitle} \title{\courseTitle}
\providecommand{\mySubTitle}{Git Basics} \providecommand{\mySubTitle}{Git Basics}
\providecommand{\myConference}{\courseTitle} \providecommand{\myConference}{\courseTitle}
\providecommand{\myGroup}{} \providecommand{\myGroup}{}
\providecommand{\myDepartment}{Department of Human Genetics} \providecommand{\myDepartment}{Department of Human Genetics}
\providecommand{\myCenter}{Center for Human and Clinical Genetics} \providecommand{\myCenter}{}
\usetheme{lumc} \usetheme{lumc}
...@@ -18,62 +18,97 @@ ...@@ -18,62 +18,97 @@
%\renewcommand{\pause}{} %\renewcommand{\pause}{}
% Make the title slide. % Make the title slide.
\makeTitleSlide{\includegraphics[width=3.5cm]{git_logo}} \makeTitleSlide{\includegraphics[width=3.5cm]{../shared/git_logo.pdf}}
% First page of the presentation. % First page of the presentation.
\section{Initialisation} \section{Starting a project}
\subsection{Starting a project} \subsection{You can either}
\begin{pframe} \begin{pframe}
Creating a new repository is easy. You do not need a server, no registration, 1. Start from scratch on your own:
etc. \vspace{-0.3cm}
\begin{lstlisting}[language=none, caption=Make a new repository.] \begin{framed}
$ cd ~/projects \prompt\ \cmd{mkdir}\ \cmdarg{my\_project}\\
$ git init \prompt\ \cmd{cd}\ \cmdarg{my\_project}\\
Initialized empty Git repository in <path>/.git/ \prompt\ \gitcmd\ \cmd{init}\\
\end{lstlisting} \cliout{Initialized empty Git repository in \{current-directory\}\/.git\/}
\end{framed}
\pause \pause
Or you can ``clone'' an existing repository. 2. Or you can \cmd{clone} an existing remote (or local) repository:
\begin{lstlisting}[language=none, caption=Clone an existing repository.] \vspace{-0.3cm}
$ git clone <path-to-repository> \begin{framed}
\end{lstlisting} \prompt\ \gitcmd\ \cmd{clone}\ \cmdarg{\<path-to-repository\>}\\
\cliout{Cloning into \{repo-name\} ...}
\end{framed}
\end{pframe} \end{pframe}
\subsection{Where does git store its repository information?}
\begin{pframe} \begin{pframe}
You can see a hidden directory in a Git repository. You can see a hidden directory in a Git repository.
\begin{lstlisting}[language=none, caption=A hidden directory is added.] \vspace{-0.3cm}
$ ls -a \begin{framed}
. .. .git \prompt\ \cmd{ls}\ \cmdopt{-a}\\
\end{lstlisting} \cliout{. .. .git}
\end{framed}
This is where git stores the files necessary to track your progress. You
rarely need to edit the contents of this directory.
\bigskip
This directory contains almost everything that Git stores and manipulates. \important{Removing this directory means removing your repository!}
\end{pframe} \end{pframe}
\section{Manipulation} \section{Git Operations}
\subsection{Local operations}
\begin{pframe} \begin{pframe}
\begin{figure}[] \vspace{-0.9cm}
\begin{center} Operations can be local or remote.\\
\includegraphics[height=0.7\textheight]{18333fig0106-tn} Most importantly, they track files around these three areas
\end{center} \footnote[1]{\scriptsize{Adapted from
\caption{Working directory, staging area, and Git directory.} \href{http://git-scm.com/book/en/v2/Getting-Started-Git-Basics}
\end{figure} {Pro Git Book}.}}:
\begin{center}
\includegraphics[width=0.7\textwidth]{images/git_areas.pdf}\\
\end{center}
\end{pframe} \end{pframe}
\subsection{Checking the status of your files} \subsection{Prelude: quick setup}
\begin{pframe} \begin{pframe}
\begin{lstlisting}[language=none, caption=Check status.] If you have never used \gitcmd\ before you need to tell it who you are. This
$ git status information is saved in \cmdarg{.gitconfig}\ and used to mark each commit.
nothing to commit (working directory clean) \vspace{-0.4cm}
\end{lstlisting} \begin{framed}
\prompt\ \gitcmd\ \cmd{config}\ \cmdopt{--global user.name}\
\cmdarg{\{your-name-or-nick-name\}}\\
\prompt\ \gitcmd\ \cmd{config}\ \cmdopt{--global user.email}\
\cmdarg{\{your-email-address\}}
\end{framed}
\pause
\vspace{-0.2cm}
Local configuration for each repository is possible as well.
\vspace{-0.4cm}
\begin{framed}
\prompt\ \gitcmd\ \cmd{config}\ \cmdopt{--local user.name}\
\cmdarg{\{your-name-or-nick-name\}}\\
\prompt\ \gitcmd\ \cmd{config}\ \cmdopt{--local user.email}\
\cmdarg{\{your-email-address\}}
\end{framed}
\vspace{-0.2cm}
\pause
``\lstinline{git status}'' can tell you whether your files are: You would like colored output?
\begin{itemize} \vspace{-0.4cm}
\item Untracked. \begin{framed}
\item Unmodified. \prompt\ \gitcmd\ \cmd{config}\ \cmdopt{--global color.ui}\ \cmdarg{auto}
\item Modified. \end{framed}
\item Staged. \end{pframe}
\end{itemize}
\subsection{Checking the status of your files}
\begin{pframe}
\begin{framed}
\prompt\ \gitcmd\ \cmd{status}\\
\cliout{nothing to commit (working directory clean)}
\end{framed}
\end{pframe} \end{pframe}
\begin{pframe} \begin{pframe}
......
This diff is collapsed.
...@@ -12,25 +12,6 @@ ...@@ -12,25 +12,6 @@
\providecommand{\myDepartment}{Department of Human Genetics} \providecommand{\myDepartment}{Department of Human Genetics}
\providecommand{\myCenter}{Center for Human and Clinical Genetics} \providecommand{\myCenter}{Center for Human and Clinical Genetics}
\definecolor{cblack}{rgb}{0,0,0}
\definecolor{cwhite}{rgb}{1,1,1}
\definecolor{command-color}{rgb}{0,0.5,0}
\definecolor{git-color}{rgb}{0.94,0.23,0.18}
\definecolor{option-color}{rgb}{0.9,0.2,0.11}
\definecolor{argument-color}{rgb}{0.11,0.27,0.7}
\definecolor{pattern-color}{rgb}{0,0.5,0.5}
\definecolor{wildcard-color}{rgb}{0.75,0.3,0}
\definecolor{cli-text}{rgb}{0.15,0.15,0.15}
\definecolor{important-note}{rgb}{0.69,0.13,0.13}
\definecolor{redirection}{rgb}{0.99,0.13,0.13}
\definecolor{shadecolor}{rgb}{0.9,0.9,0.9}
\definecolor{one-dot}{rgb}{0.9,0.2,0.0}
\definecolor{two-dots}{rgb}{0.11,0.11,0.8}
\definecolor{slash}{rgb}{0.3,0.3,0.3}
\definecolor{head}{HTML}{B22222}
\definecolor{branch}{HTML}{20b2aa}
\definecolor{commit-id}{HTML}{b8860b}
\usetheme{lumc} \usetheme{lumc}
...@@ -297,7 +278,7 @@ ...@@ -297,7 +278,7 @@
Creates branch \textcolor{branch}{\lstinline{lib}} at \textcolor{head}{\lstinline{HEAD}}. Creates branch \textcolor{branch}{\lstinline{lib}} at \textcolor{head}{\lstinline{HEAD}}.
\pause \pause
\medskip \medskip
How can I see that it worked? How can I see that it worked?
\pause \pause
\vspace{-0.3cm} \vspace{-0.3cm}
...@@ -311,17 +292,17 @@ ...@@ -311,17 +292,17 @@
\end{framed} \end{framed}
\vspace{-0.2cm} \vspace{-0.2cm}
\pause \pause
How can I switch to the new \textcolor{branch}{\lstinline{lib}} branch? How can I switch to the new \textcolor{branch}{\lstinline{lib}} branch?
\end{pframe} \end{pframe}
\begin{pframe} \begin{pframe}
\begin{framed} \begin{framed}
\lstinline{$} \textcolor{git-color}{\lstinline{git}} \textcolor{command-color}{\lstinline{checkout}} \textcolor{argument-color}{\lstinline{lib}}\\ \lstinline{$} \textcolor{git-color}{\lstinline{git}} \textcolor{command-color}{\lstinline{checkout}} \textcolor{argument-color}{\lstinline{lib}}\\
\lstinline{Switched to branch '}\textcolor{branch}{\lstinline{lib}}\lstinline{'} \lstinline{Switched to branch '}\textcolor{branch}{\lstinline{lib}}\lstinline{'}
\end{framed} \end{framed}
\end{pframe} \end{pframe}
\begin{pframe} \begin{pframe}
For Git pro's, in one command: For Git pro's, in one command:
\begin{framed} \begin{framed}
...@@ -441,7 +422,7 @@ ...@@ -441,7 +422,7 @@
\begin{pframe} \begin{pframe}
Make sure that the working directory is clean before merging. Make sure that the working directory is clean before merging.
\medskip \medskip
Otherwise: Otherwise:
\vspace{-0.3cm} \vspace{-0.3cm}
\begin{framed} \begin{framed}
...@@ -513,7 +494,7 @@ ...@@ -513,7 +494,7 @@
\lstinline{* }\textcolor{commit-id}{\lstinline{5edaf08}}\lstinline{ (}\textcolor{branch}{\lstinline{hue}}\lstinline{) State character ...}\\ \lstinline{* }\textcolor{commit-id}{\lstinline{5edaf08}}\lstinline{ (}\textcolor{branch}{\lstinline{hue}}\lstinline{) State character ...}\\
\lstinline{| * }\textcolor{commit-id}{\lstinline{f1ef19c}}\lstinline{ (}\textcolor{head}{\lstinline{HEAD}}\lstinline{, }\textcolor{branch}{\lstinline{master}}\lstinline{) State character ...}\\ \lstinline{| * }\textcolor{commit-id}{\lstinline{f1ef19c}}\lstinline{ (}\textcolor{head}{\lstinline{HEAD}}\lstinline{, }\textcolor{branch}{\lstinline{master}}\lstinline{) State character ...}\\
\lstinline{|/}\\ \lstinline{|/}\\
\lstinline{* }\textcolor{commit-id}{\lstinline{1f6d2ab}}\lstinline{ Initial commit} \lstinline{* }\textcolor{commit-id}{\lstinline{1f6d2ab}}\lstinline{ Initial commit}
\end{framed} \end{framed}
We'd like to merge branch \textcolor{branch}{\lstinline{hue}} into \textcolor{branch}{\lstinline{master}}. We'd like to merge branch \textcolor{branch}{\lstinline{hue}} into \textcolor{branch}{\lstinline{master}}.
......
\usepackage{framed}
\providecommand{\courseTitle}{Code and data management with Git} \providecommand{\courseTitle}{Code and data management with Git}
\providecommand{\myDate}{22-11-2017} \providecommand{\myDate}{22-11-2017}
\providecommand{\acknowledgements}{ \providecommand{\acknowledgements}{
...@@ -6,3 +8,31 @@ ...@@ -6,3 +8,31 @@
Szymon Kie{\l}basa\\ Szymon Kie{\l}basa\\
Jeroen Laros\\ Jeroen Laros\\
} }
\definecolor{cblack}{rgb}{0,0,0}
\definecolor{cwhite}{rgb}{1,1,1}
\definecolor{command-color}{rgb}{0,0.5,0}
\definecolor{git-color}{rgb}{0.94,0.23,0.18}
\definecolor{option-color}{HTML}{483d8b}
\definecolor{argument-color}{rgb}{0.11,0.27,0.7}
\definecolor{pattern-color}{rgb}{0,0.5,0.5}
\definecolor{wildcard-color}{rgb}{0.75,0.3,0}
\definecolor{cli-text}{rgb}{0.15,0.15,0.15}
\definecolor{important-note}{rgb}{0.69,0.13,0.13}
\definecolor{redirection}{rgb}{0.99,0.13,0.13}
\definecolor{shadecolor}{rgb}{0.9,0.9,0.9}
\definecolor{one-dot}{rgb}{0.9,0.2,0.0}
\definecolor{two-dots}{rgb}{0.11,0.11,0.8}
\definecolor{slash}{rgb}{0.3,0.3,0.3}
\definecolor{head}{HTML}{B22222}
\definecolor{branch}{HTML}{20b2aa}
\definecolor{commit-id}{HTML}{b8860b}
\newcommand{\gitcmd}{\textcolor{git-color}{\lstinline{git}}}
\newcommand{\prompt}{\lstinline{$}}
\newcommand{\cmd}[1]{\textcolor{command-color}{\lstinline{#1}}}
\newcommand{\cmdarg}[1]{\textcolor{argument-color}{\lstinline{#1}}}
\newcommand{\cmdopt}[1]{\textcolor{option-color}{\lstinline{#1}}}
\newcommand{\cliout}[1]{\textcolor{cli-text}{\lstinline{#1}}}
\newcommand{\important}[1]{\textbf{\textcolor{important-note}{#1}}}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment