diff --git a/remotes/remotes.tex b/remotes/remotes.tex index ce4f1ec54e0f2023166bf02a41415a793e6db810..a5a72841766e27f6621f67d661d55930c9ccf6ba 100644 --- a/remotes/remotes.tex +++ b/remotes/remotes.tex @@ -108,15 +108,15 @@ \subsection{Updating remote commits: \texttt{git fetch}} \begin{pframe} - \begin{lstlisting} -$ git fetch hue -remote: Counting objects: 5, done. -remote: Compressing objects: 100% (2/2), done. -remote: Total 3 (delta 0), reused 0 (delta 0) -Unpacking objects: 100% (3/3), done. -From 192.168.0.8:docs/tv-series - * [new branch] master -> hue/master - \end{lstlisting} + \begin{framed} +\prompt\ \gitcmd\ \cmd{fetch} \cmdarg{hue}\\ +\cliout{remote: Counting objects: 5, done.} +\cliout{remote: Compressing objects: 100\% (2/2), done.}\\ +\cliout{remote: Total 3 (delta 0), reused 0 (delta 0)}\\ +\cliout{Unpacking objects: 100\% (3/3), done.}\\ +\cliout{From 192.168.0.8:docs/tv-series}\\ +\cliout{ * [new branch] master -> hue/master}\\ + \end{framed} \pause \includegraphics[width=10cm]{example-hue} @@ -125,13 +125,13 @@ From 192.168.0.8:docs/tv-series \subsection{Merging remote information: \texttt{git merge}} \begin{pframe} We can merge the commits from a remote into our own. - \begin{lstlisting} -$ git merge hue/master -Updating c7f3bd9..251a51b -Fast-forward -testlib.py | 2 + -1 file changed, 2 insertions(+) - \end{lstlisting} + \begin{framed} +\prompt\ \gitcmd\ \cmd{merge} \cmdarg{hue/master}\\ +\cliout{Updating c7f3bd9..251a51b}\\ +\cliout{Fast-forward}\\ +\cliout{testlib.py | 2 +}\\ +\cliout{1 file changed, 2 insertions(+)} + \end{framed} \pause \includegraphics[width=10cm]{example-hue-merged} @@ -141,10 +141,10 @@ testlib.py | 2 + \begin{pframe} If we add some more commits, our local repository gets ahead of the remote repository. - \begin{lstlisting} -$ ... -$ git commit - \end{lstlisting} + \begin{framed} +\prompt\ ... \\ +\prompt\ \gitcmd\ \cmd{commit} + \end{framed} \pause \includegraphics[width=10cm]{example-hue-ahead} @@ -153,16 +153,16 @@ $ git commit \subsection{Pushing changes to a remote: \texttt{git push}} \begin{pframe} \vspace{-0.5cm} - \begin{lstlisting} -$ git push hue master -Counting objects: 5, done. -Delta compression using up to 4 threads. -Compressing objects: 100% (2/2), done. -Writing objects: 100% (3/3), 303 bytes, done. -Total 3 (delta 1), reused 0 (delta 0) -To hue.remote:docs/tv-series - 0535b7e..0676334 simpsons -> simpsons -\end{lstlisting} + \begin{framed} +\prompt\ \gitcmd\ \cmd{push} \cmdarg{hue} \cmdarg{master}\\ +\cliout{Counting objects: 5, done.}\\ +\cliout{Delta compression using up to 4 threads.}\\ +\cliout{Compressing objects: 100\% (2/2), done.}\\ +\cliout{Writing objects: 100\% (3/3), 303 bytes, done.}\\ +\cliout{Total 3 (delta 1), reused 0 (delta 0)}\\ +\cliout{To hue.remote:docs/tv-series}\\ +\cliout{0535b7e..0676334 simpsons -> simpsons} + \end{framed} \pause \includegraphics[width=9cm]{example-hue-pushed} @@ -170,44 +170,52 @@ To hue.remote:docs/tv-series \subsection{Cloning an existing repository} \begin{pframe} - Instead of creating repositories using \lstinline{git init}, you can create a + Instead of creating repositories using \gitcmd\ \cmd{init}, you can create a local {\em clone} of an existing (remote) repository. - \begin{lstlisting}[basicstyle=\ttfamily\footnotesize] -$ git clone https://git.lumc.nl/zorro/tv-series.git -Cloning into 'tv-series'... -remote: Counting objects: 6, done. -remote: Compressing objects: 100% (4/4), done. -remote: Total 6 (delta 1), reused 0 (delta 0) -Unpacking objects: 100% (6/6), done. - \end{lstlisting} - \pause + \begin{framed} +\prompt\ \gitcmd\ \cmd{clone} \cmdarg{https://git.lumc.nl/zorro/tv-series.git}\\ +\cliout{Cloning into 'tv-series'...}\\ +\cliout{remote: Counting objects: 6, done.}\\ +\cliout{remote: Compressing objects: 100\% (4/4), done.}\\ +\cliout{remote: Total 6 (delta 1), reused 0 (delta 0)}\\ +\cliout{Unpacking objects: 100\% (6/6), done.} + \end{framed} +\end{pframe} - A remote called \lstinline{origin} is added for the original repository +\begin{pframe} + A remote called \cmdarg{origin} is added for the original repository automatically. - \begin{lstlisting}[basicstyle=\ttfamily\footnotesize] -$ cd tv-series/ -$ git remote -v -origin https://git.lumc.nl/zorro/tv-series.git (fetch) -origin https://git.lumc.nl/zorro/tv-series.git (push) - \end{lstlisting} + \begin{framed} +\prompt\ \cmd{cd} \cmdarg{tv-series/}\\ +\prompt\ \gitcmd\ \cmd{remote} \cmdopt{-v}\\ +\small{ +\cliout{origin https://git.lumc.nl/zorro/tv-series.git (fetch)}\\ +\cliout{origin https://git.lumc.nl/zorro/tv-series.git (push)}} + \end{framed} \end{pframe} \subsection{Shortcuts for pulling and pushing} \begin{pframe} - The full forms of \lstinline{git push/fetch/merge} get boring quickly, so + The full forms of \gitcmd\ \cmd{push}/\cmd{fetch}/\cmd{merge} get boring quickly, so there are some shortcuts. \bigskip \pause - For example, if our remote is called \lstinline{origin}: - \begin{lstlisting} -$ git push ==> $ git push origin master - \end{lstlisting} + For example, if our remote is called \cmdarg{origin}: + \vspace{-0.3cm} + \begin{framed} +\prompt\ \gitcmd\ \cmd{push}\\ +--------\\ +\prompt\ \gitcmd\ \cmd{push} \cmdarg{origin} \cmdarg{master} + \end{framed} + \vspace{-0.6cm} - \begin{lstlisting} -$ git pull ==> $ git fetch origin - $ git merge origin/master - \end{lstlisting} + \begin{framed} +\prompt\ \gitcmd\ \cmd{pull}\\ +--------\\ +\prompt\ \gitcmd\ \cmd{fetch} \cmdarg{origin}\\ +\prompt\ \gitcmd\ \cmd{merge} \cmdarg{origin/master} + \end{framed} \end{pframe} \subsection{Shortcuts for pulling and pushing (setup)} @@ -216,11 +224,11 @@ $ git pull ==> $ git fetch origin there are some shortcuts. \bigskip - This needs configuration by using \lstinline{git push} with \lstinline{-u} + This needs configuration by using \gitcmd\ \cmd{push} with \cmdopt{-u} once: - \begin{lstlisting} -$ git push origin master -u - \end{lstlisting} + \begin{framed} +\prompt\ \gitcmd\ \cmd{push} \cmdarg{origin} \cmdarg{master} \cmdopt{-u} + \end{framed} If your repository was created by cloning, this is already done. \end{pframe} @@ -238,9 +246,9 @@ $ git push origin master -u \subsection{The HTTP(S) protocol} \begin{pframe} Most popular protocol when the remote repository is on a server. - \begin{lstlisting} -$ git clone https://example.com/gitproject.git - \end{lstlisting} + \begin{framed} +\prompt\ \gitcmd\ \cmd{clone} \cmdarg{https://example.com/gitproject.git} + \end{framed} For pushing (or fetching if the repository is private), this asks for your username and password everytime. @@ -250,9 +258,9 @@ $ git clone https://example.com/gitproject.git \begin{pframe} Most convenient protocol when the remote repository is private or you are a regular contributor. - \begin{lstlisting} -$ git clone user@example.com:gitproject.git - \end{lstlisting} + \begin{framed} +\prompt\ \gitcmd\ \cmd{clone} \cmdarg{user@example.com:gitproject.git} + \end{framed} This usually requires public/private key authentication. \end{pframe}