diff --git a/git-tutorial.tex b/git-tutorial.tex index 17d64493ef2f21603fc359d731ba1c6e194ffb11..dfcd56249d1521b298223fdb8be90ae93a0b2ccc 100644 --- a/git-tutorial.tex +++ b/git-tutorial.tex @@ -44,6 +44,21 @@ first two reasons listed below: \label{fig:chaos} \end{figure} + +But why use git instead of cvs, subversion, clearcase, or any other +well-known version control tool? +\begin{itemize} +\item Git is free, both as in speech and in beer, unlike Clearcase, + Team Foundation andcial systems. +\item Git is distributed. When each user has her own repository copy + you do not always need to have contact with a central server. +\item There is a large Internet community around git making it easy to + find information and/or help when needed. +\item It is used in some large high profile open source projects. Most + known is the Linux kernel. +\end{itemize} + + \section{Git Tools} \label{sec:tools} @@ -77,6 +92,7 @@ for versioning your own small projects. Then we will show what happens when we want to work in a distributed context, cooperating with other people. + \subsection{Standalone Repository} \label{sec:standalone} The simplest use case is that of one single developer, one local @@ -100,6 +116,12 @@ following stages as you work on them, see Figure~\ref{fig:lifecycle}: \label{fig:lifecycle} \end{figure} +\subsubsection*{Help} +If you wonder what a git command do or which arguments it takes, just +remember that \verb|git help| will list the most common git commands +and \verb|git help command| will show the git manual for the given +command. + \subsubsection*{First time configuration} On each computer (or for each user account) you need to tell git your @@ -241,7 +263,7 @@ terse, are important as they can be of good use when you or someone else at some time look back into the revision history and try to find out what happened and when. \begin{lstlisting} -andersn@stodola: git commit -am"Initial commit" +andersn@stodola: git commit -a -m"Initial commit" [master (root-commit) c6d834c] Initial commit 3 files changed, 146 insertions(+) create mode 100644 .gitignore @@ -252,6 +274,12 @@ andersn@stodola: git status # On branch master nothing to commit (working directory clean) \end{lstlisting} +A brief explanation of the command options. \verb|-a| means that all +modified files will be staged before commit, without it we would only +commit newly added files. \verb|-m| says that a revision comment will +follow efter it, without it a text editor (perhaps vi) would start and +allow you to edit a more comprehensive comment. + After performing the first commit, work goes on. New files are added and existing files are edited. Whenever it feels motivated, add new @@ -315,9 +343,46 @@ To stodola.control.lth.se:work/computers/git-tutorial ebf6fbb..15f6453 master -> master \end{lstlisting} +\subsection{Other useful commands} +\label{sec:other} +In addition to the above listed git operations, there are a few more +operations that are good to know right from start. + +\subsubsection*{log} +\label{log} +\begin{lstlisting} +andersn@stodola: git log +commit 846bf870955b4eae2a5fd7bb6f5071af6b7a9003 +Author: Anders Nilsson <andersn@control.lth.se> +Date: Wed Mar 20 09:32:35 2013 +0100 + + Addded chaos figure and some motivation + +commit 95390dea5ea41624953f566fc077c8a8bdbfaf3a +Author: Anders Nilsson <anders@angsro14.se> +Date: Tue Mar 19 23:02:44 2013 +0100 + + Last changes for tonight +\end{lstlisting} +\verb|git log| lists all commits in reverse chronological order. In +the example above that the last commits were performed by different +users; myself at home and myself at work. + +\subsubsection*{diff} +\label{diff} + + +\subsubsection*{merge} +\label{merge} + +\subsubsection*{blame} +\label{blame} + + + \section{Further Reading} \label{sec:furtherreading} - +Some useful links: \begin{itemize} \item A cheat sheet is good to print out and have at hand next to your keyboard: \\ \verb|http://git-scm.com/documentation| @@ -327,4 +392,7 @@ To stodola.control.lth.se:work/computers/git-tutorial online: \verb|http://git-scm.com/book| \end{itemize} +In general, Google is your friend, and there are literally hundreds +(if not thousands) of freely available git references, Q\&A:s, and +tutorials out there. \end{document}