Big info update, branching and more committing
[ai-gitflashtalk.git] / git.tex
diff --git a/git.tex b/git.tex
index eef261c..c8a6a7a 100644 (file)
--- a/git.tex
+++ b/git.tex
        \end{block}
 \end{frame}
 
-\section{Basics}
-\subsection{Installation}
+\section{Installation}
 \begin{frame}[fragile]
        \begin{block}{{\Large\Smiley\Smiley} Linux}
                Depending on the distribution you may have to do:\\
-               \lstinline{# apt-get install git}\\
-               \lstinline{# pacman -S git}\\
-               \lstinline{# yum install git}\\
-               \lstinline{# emerge --ask dev-vcs/git}\\
+               \texttt{\# apt-get install git}\\
+               \texttt{\# pacman -S git}\\
+               \texttt{\# yum install git}\\
+               \texttt{\# emerge --ask dev-vcs/git}\\
                Etc\ldots
        \end{block}
                
 
 \end{frame}
 
-\subsection{Getting started}
+\section{Getting started \& workflow}
 \begin{frame}[fragile]
        \frametitle{Getting started}
-       \begin{block}{Check GIT version in (git) bash}
+       \begin{block}{Check GIT version in (GIT) bash}
                \begin{lstlisting}
 frobnicator@frobmachine:~\$ git --version
 git version 1.7.10.4
@@ -103,6 +102,7 @@ git version 1.7.10.4
                \begin{lstlisting}
 frobnicator@frobmachine:~/projects\$ git init myfirstproject
 Initialized empty Git repository in /home/frobnicator/projects/myfirstproject/.git/
+
 frobnicator@frobmachine:~/projects\$ ls -1 myfirstproject/.git
 branches/
 config
@@ -116,7 +116,6 @@ refs/
        \end{block}
 \end{frame}
 
-\subsection{Four (five) stages}
 \begin{frame}
        \frametitle{Four (five) stages}
        \begin{itemize}
@@ -137,10 +136,12 @@ refs/
        \end{figure}
 \end{frame}
 
+\section{Everything is a commit}
 \begin{frame}[fragile]
        \frametitle{Add and commit}
        \begin{lstlisting}
-frobnicator@frobmachine:~/projects/myfirstproject\$ echo "This is a frobfile" > frobbedfile
+frobnicator@frobmachine :~/projects/myfirstproject\$ echo "This is a frobfile" > frobbedfile
+
 frobnicator@frobmachine:~/projects/myfirstproject\$ git status
 On branch master
 
@@ -158,6 +159,7 @@ nothing added to commit but untracked files present (use "git add" to track)
 \begin{frame}[fragile]
        \begin{lstlisting}
 frobnicator@frobmachine:~/projects/myfirstproject\$ git add frobbedfile
+
 frobnicator@frobmachine:~/projects/myfirstproject\$ git status
 On branch master
 
@@ -167,6 +169,7 @@ Changes to be committed:
   (use "git rm --cached <file>..." to unstage)
 
        new file:   frobbedfile
+
 frobnicator@frobmachine:~/projects/myfirstproject\$ git commit
 [master (root-commit) 2b7355e] Adds frobbedfile
  1 file changed, 1 insertion(+)
@@ -174,18 +177,160 @@ frobnicator@frobmachine:~/projects/myfirstproject\$ git commit
        \end{lstlisting}
 \end{frame}
 
+\begin{frame}[fragile]
+       \frametitle{Log \& Checkout}
+       \begin{lstlisting}
+frobnicator@frobmachine~/projects/myfirstproject\$ echo "This is a second frobbedfile" > frob2
+frobnicator@frobmachine~/projects/myfirstproject\$ git add frob2
+frobnicator@frobmachine~/projects/myfirstproject\$ git commit -m "This is a second commit"
+[master cd094bc] This is a second commit
+ 1 file changed, 1 insertion(+)
+ create mode 100644 frob2
+       \end{lstlisting}
+\end{frame}
+
+\begin{frame}[fragile]
+       \frametitle{Log \& Checkout 2}
+       \begin{lstlisting}
+frobnicator@frobmachine~/projects/myfirstproject\$ git log
+commit cd094bc6b81812256533395454db22da07d1e5a4
+Author: Frob Nicator <frob@nicator.net>
+Date:   Thu Apr 16 22:44:42 2015 +0200
+
+    This is a second commit
+
+commit c9c9b358cddcbee541ec433a2dc2d5ffe3e928c2
+Author: Frob Nicator <frob@nicator>
+Date:   Thu Apr 16 22:44:42 2015 +0200
+
+    Adds frobbedfile
+frobnicator@frobmachine~/projects/myfirstproject\$ ls
+frob2  frobbedfile
+       \end{lstlisting}
+\end{frame}
+
+\begin{frame}[fragile]
+       \frametitle{Log \& Checkout 2}
+       \begin{lstlisting}
+frobnicator@frobmachine~/projects/myfirstproject\$ git checkout c9c9b3
+Note: checking out 'c9c9b3'.
+
+You are in 'detached HEAD' state. You can look around, make experimental
+changes and commit them, and you can discard any commits you make in this
+state without impacting any branches by performing another checkout.
+
+If you want to create a new branch to retain commits you create, you may
+do so (now or later) by using -b with the checkout command again. Example:
+
+  git checkout -b new_branch_name
+
+HEAD is now at c9c9b35... Adds frobbedfile
+frobnicator@frobmachine~/projects/myfirstproject\$ ls
+frobbedfile
+       \end{lstlisting}
+\end{frame}
+
+\begin{frame}[fragile]
+       \frametitle{Log \& Checkout 3}
+       \framesubtitle{We lost our commit and our file!}
+       \begin{lstlisting}
+frobnicator@frobmachine~/projects/myfirstproject\$ git log
+commit c9c9b358cddcbee541ec433a2dc2d5ffe3e928c2
+Author: Frob Nicator <frob@nicator>
+Date:   Thu Apr 16 22:44:42 2015 +0200
+
+    Adds frobbedfile
+frobnicator@frobmachine~/projects/myfirstproject\$ ls
+frobbedfile
+       \end{lstlisting}
+\end{frame}
+
+\begin{frame}[fragile]
+       \frametitle{Log \& Checkout 4}
+       \begin{block}{Ofcourse not, you never lose stuff with git}
+               \begin{lstlisting}
+frobnicator@frobmachine~/projects/myfirstproject\$ git log --all
+commit cd094bc6b81812256533395454db22da07d1e5a4
+Author: Frob Nicator <frob@nicator.net>
+Date:   Thu Apr 16 22:44:42 2015 +0200
+
+    This is a second commit
+...
+...
+               \end{lstlisting}
+       \end{block}
+\end{frame}
+
+\begin{frame}[fragile]
+       \frametitle{Log \& Checkout 5}
+       \begin{block}{We can just checkout the hash again}
+               \begin{lstlisting}
+frobnicator@frobmachine~/projects/myfirstproject\$ ls
+frob2  frobbedfile
+frobnicator@frobmachine~/projects/myfirstproject\$ git log --decorate --oneline --graph --all
+* cd094bc (HEAD, master) This is a second commit
+* c9c9b35 Adds frobbedfile
+               \end{lstlisting}
+       \end{block}
+\end{frame}
+
+
+\section{Branching and unevitable merging}
+\begin{frame}
+       \frametitle{Branching}
+       \begin{itemize}
+               \item Commit: State of the folder. Has and knows his parent.\\
+               \item Branch: Just a named commit.\\
+                       Usually a sidetrack of a project.\\
+                       Master, develop, feature, etc\ldots
+               \item Tag: Just a named commit.\\
+                       Usually marked point to jump to later on.\\
+                       eg. Version release, big change etc\ldots
+       \end{itemize}
+\end{frame}
+
+\begin{frame}[fragile]
+       \frametitle{Branching 2}
+       \begin{block}{See current branch}
+               \begin{lstlisting}
+frobnicator@frobmachine~/projects/gitflashtalk/myfirstproject\$ git branch
+* master
+               \end{lstlisting}
+       \end{block}
+       \begin{block}{Create new branch}
+               \begin{lstlisting}
+frobnicator@frobmachine~/projects/gitflashtalk/myfirstproject\$ git checkout -b "develop"
+Switched to a new branch 'develop'
+frobnicator@frobmachine~/projects/gitflashtalk/myfirstproject\$ git branch
+* develop
+  master
+               \end{lstlisting}
+       \end{block}
+       \begin{block}{Delete branch}
+               \begin{lstlisting}
+frobnicator@frobmachine~/projects/gitflashtalk/myfirstproject\$ git branch -d "develop"
+Deleted branch develop (was cd094bc).
+frobnicator@frobmachine~/projects/gitflashtalk/myfirstproject\$ git branch
+* master
+               \end{lstlisting}
+       \end{block}
+\end{frame}
+
 \begin{frame}
-       \frametitle{Push}
+       \frametitle{Push \& Pull}
 \end{frame}
 
 \begin{frame}
-       \frametitle{Add and commit}
+       \frametitle{Merge}
 \end{frame}
 
+\section{Tips \& Tricks}
 \begin{frame}
-       \frametitle{Add and commit}
+       \frametitle{\texttt{/home/frobnicator/.gitconfig}}
 \end{frame}
 
-\section{Branching}
+\begin{frame}
+       \frametitle{Public key}
 
+\end{frame}
 \end{document}