diff --git a/handson.tex b/handson.tex new file mode 100644 index 0000000000000000000000000000000000000000..1a46e2d30e6368d3d35989e5a4d0639b143150bb --- /dev/null +++ b/handson.tex @@ -0,0 +1,107 @@ +\documentclass[a4paper,10pt,twoside]{article} +\usepackage{a4wide} +\usepackage{palatino} +\usepackage{tikz} +\usepackage{listings} + +\title{Git Hands-On\\ \tiny{Version: 0.1}} +\author{Anders Nilsson \\ + \texttt{andersn@control.lth.se}} + +\lstset{ + frame=single, + basicstyle=\footnotesize\ttfamily +} + + +\begin{document} +\maketitle{} + +\section{Introduction} +\label{sec:intro} + +It is assumed tha you have working installation of git on your +computer. This hands-on tutorial will straight through use text mode +git as run in a terminal window. Feel free to use a graphical client +of your choice instead if that makes you feel better. + + +\section{Setting up} +\label{sec:setup} + +Begin by opening a web browser and go to +\texttt{http://gitlab.control.lth.se} and sign up for a new account, +or authenticate using a google ID if you prefer that. + +% When you have signed in, tell me which project group you belong to. + +% When get an acknowledgement on group memebership, +Now you can set up the environment for the rest of the exercise. Start +by telling git your name and email: +\begin{lstlisting} +git config --global user.name "Anders Nilsson" +git config --global user.email "andersn@control.lth.se" +\end{lstlisting} +Then let's clone the playground repository: +\begin{lstlisting} +git clone ssh://git@gitlab.control.lth.se:/frt090-2014/playground.git +cd playground +\end{lstlisting} + +\section{edit - commit - push} +\label{sec:edit} + +Open the file \emph{Readme} in a text editor and add some lines of text to the file. Then save. +\begin{lstlisting} +gedit Readme +\end{lstlisting} +Use \texttt{git status} to check for modified files in the working copy. +\begin{lstlisting} +andersn@stodola:/tmp/playground\$ git status +On branch master +Your branch is up-to-date with 'origin/master'. + +Changes not staged for commit: + (use "git add <file>..." to update what will be committed) + (use "git checkout -- <file>..." to discard changes in working directory) + + modified: Readme + +no changes added to commit (use "git add" and/or "git commit -a") + +\end{lstlisting} +Commit your changes to the local repository, with some useful commit comment. +\begin{lstlisting} +andersn@stodola:/tmp/playground\$ git commit -am"Added a new line." +[master 50c3451] Added a new line. + 1 file changed, 2 insertions(+), 1 deletion(-) +\end{lstlisting} +Run \texttt{git status} again to see what has happened. +\begin{lstlisting} +andersn@stodola:/tmp/playground\$ git status +On branch master +Your branch is ahead of 'origin/master' by 1 commit. + (use "git push" to publish your local commits) + +nothing to commit, working directory clean +\end{lstlisting} +This means that you have local commits which are not yet available on +the git server. To publish your changes on the server, run \texttt{git + push}. +\begin{lstlisting} +andersn@stodola:/tmp/t/playground\$ git push +Counting objects: 5, done. +Delta compression using up to 8 threads. +Compressing objects: 100\% (2/2), done. +Writing objects: 100\% (3/3), 306 bytes | 0 bytes/s, done. +Total 3 (delta 0), reused 0 (delta 0) +To ssh://git@gitlab.control.lth.se:/frt090-2014/playground.git + 8a8ad08..eb02c3c master -> master +\end{lstlisting} + +\section{Handling Conflicts} + +If the previous push command went as shown, you happened to be the +first in tyhe group to perform a push. + +\end{document} \ No newline at end of file