Skip to content

Commit e6b8a8b

Browse files
committed
Upades of the Git chapter.
Signed-off-by: V-Z <vojta@trapa.cz>
1 parent 724ab20 commit e6b8a8b

File tree

1 file changed

+67
-16
lines changed

1 file changed

+67
-16
lines changed

presentation/linux_bash_metacentrum_course.tex

Lines changed: 67 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3095,7 +3095,7 @@ \subsection{Regular expressions}
30953095
%
30963096
% \begin{frame}{Text tasks}
30973097
% \begin{enumerate}
3098-
% \item
3098+
% \item
30993099
% \end{enumerate}
31003100
% \end{frame}
31013101
@@ -4347,29 +4347,69 @@ \subsection{Data storage}
43474347
%
43484348
% \begin{frame}{MetaCloud}
43494349
% \begin{itemize}
4350-
% \item
4350+
% \item
43514351
% \end{itemize}
43524352
% \end{frame}
43534353
4354-
4355-
\section{Git} % TODO More general info about Git, separate GitHub to extra slide
4354+
\section{Git}
43564355
43574356
\begin{frame}{Git}
43584357
\tableofcontents[currentsection, sectionstyle=show/hide, hideothersubsections]
43594358
\end{frame}
43604359
4361-
\begin{frame}[fragile]{Git and GitHub}
4360+
\subsection{Git principle}
4361+
4362+
\begin{frame}[allowframebreaks]{Git and version control}
43624363
\begin{itemize}
43634364
\item \href{https://git-scm.com/}{Git} is \href{https://en.wikipedia.org/wiki/Version_control}{version controlling} system --- it traces changes among all versions --- absolutely crucial for any software development
4364-
\item \href{https://github.com/}{GitHub} is currently probably the most popular platform to host development of open-source projects, see \href{https://help.github.com/}{documentation}
4365-
\item Older (nowadays not so common) version controlling systems is Subversion (SVN), there are many more (Bazaar,~\ldots)
4365+
\item Older (nowadays not so common) version controlling systems is Subversion (SVN), there are many more (Bazaar, Mercurial,~\ldots)
43664366
\item Probably the best textbook for Git is \href{https://git-scm.com/book/en/v2}{Chacon's Pro Git}
43674367
\begin{itemize}
43684368
\item Dostupná i~\href{https://git-scm.com/book/cs/v2}{česky} (včetně \href{https://knihy.nic.cz/}{prvního vydání})
43694369
\end{itemize}
43704370
\item Changes and their history is stored in repository (local or network, shared or private) --- it is possible to view any historical state and differences between any versions
43714371
\item It is possible to trace who and when did what
43724372
\item Branching and merging of branches helps with making of big changes
4373+
\item Users work on a project in some directory as usually and from time to time commit local changes to stagging (temporal area) and then push them to remote or local repository (directory storing all Git history of particular project, can be anywhere)
4374+
\item Every commit is checkpoint in the history
4375+
\begin{itemize}
4376+
\item Can be tagged (named), e.g. particular released version of software, or project stage
4377+
\item User can compare any two commits or commit and current state
4378+
\end{itemize}
4379+
\item Code can be branched
4380+
\begin{itemize}
4381+
\item When new branch is created, it contains copy of current state
4382+
\item User selects in which branch she/he is working, the branches are diverging, user can commit in every branch independently
4383+
\item Commits in various branches can be compared and branches can be merged again
4384+
\item Key feature of Git --- branches are useful when user starts to work on any big change in the project
4385+
\end{itemize}
4386+
\item Stagging area serves as local \enquote{container} of changes to be pushed to central Git repository (or to be modified, discarded)
4387+
\begin{itemize}
4388+
\item It is very hard to do any change in the central Git repository (e.g. to remove accidentaly pushed file or change description)
4389+
\end{itemize}
4390+
\item Central repository keeps whole history of the project
4391+
\begin{itemize}
4392+
\item Every user has full copy of the central Git repository --- can be large
4393+
\item Can be placed on some server, network disk, in the local computer,~\ldots
4394+
\end{itemize}
4395+
\item Git was developed by Linus to trace development of Linux kernel, now it is probably the most used version control tool, used also by Microsoft to trace development of Windows :-)
4396+
\end{itemize}
4397+
\end{frame}
4398+
4399+
\begin{frame}{GitHub and others}
4400+
\begin{itemize}
4401+
\item \href{https://github.com/}{GitHub} is currently probably the most popular platform to host development of open-source projects, see \href{https://help.github.com/}{documentation}
4402+
\item Probably second most common on-line service providing Git repository is \href{https://about.gitlab.com/}{GitLab}
4403+
\begin{itemize}
4404+
\item User can create an account on GitLab (as on GitHub), or download and install GitLab system on own server
4405+
\end{itemize}
4406+
\item \href{https://sourceforge.net/}{SourceForge} used to be more popular in the past, still harbours plenty of interesting projects
4407+
\item For on-line services, many tools are available only for paying customers
4408+
\item All such services provide Git repositories accessible through standard tools (from command line, see further; or from some special application)
4409+
\begin{itemize}
4410+
\item Exact usage might differ from standard Git, check respective help pages first
4411+
\end{itemize}
4412+
\item Git repository can be easily hosted e.g. on any Linux server\ldots
43734413
\end{itemize}
43744414
\end{frame}
43754415
@@ -4392,7 +4432,7 @@ \section{Git} % TODO More general info about Git, separate GitHub to extra slide
43924432
\end{itemize}
43934433
\end{itemize}
43944434
\begin{center}
4395-
\includegraphics[height=5.75cm]{git.png}
4435+
\includegraphics[height=6.5cm]{git.png}
43964436
\end{center}
43974437
\begin{flushright}
43984438
\begin{footnotesize}
@@ -4402,10 +4442,14 @@ \section{Git} % TODO More general info about Git, separate GitHub to extra slide
44024442
\end{multicols}
44034443
\end{frame}
44044444
4445+
\subsection{Git basics}
4446+
44054447
\begin{frame}[fragile]{Working with Git --- start and sending changes}
44064448
\begin{bashcode}
4407-
# Create a new repository for new project
4449+
# Create a new repository for new project (in empty directory)
44084450
git init # No need when cloning from existing repository
4451+
# Create a new central repository (e.g. on a server) in empty directory
4452+
git init --bare
44094453
# Or checkout (make a copy) for another local or remote repository
44104454
git clone /path/to/local/repository # Locally mounted repository
44114455
git clone username@host:/path/to/remote/repository # Over SSH
@@ -4420,13 +4464,13 @@ \section{Git} % TODO More general info about Git, separate GitHub to extra slide
44204464
git remote add origin <location> # Do only once on the beginning
44214465
# <location> can be remote server or local path
44224466
git remote add origin . # For repository within working directory
4423-
# Push changes into the repository (regardless where it is)
4424-
git push origin master # See further for selection of branches
44254467
\end{bashcode}
44264468
\end{frame}
44274469
44284470
\begin{frame}[fragile]{Working with Git --- branching and getting changes}
44294471
\begin{bashcode}
4472+
# Push changes into the repository (regardless where it is)
4473+
git push origin master # See further for selection of branches
44304474
# Making new branch and switching to it
44314475
git checkout -b NewFeature # Now we are in branch NewFeature
44324476
# Switch back to branch master
@@ -4444,13 +4488,13 @@ \section{Git} % TODO More general info about Git, separate GitHub to extra slide
44444488
git pull # Fetch and merge remote changes (before commit)
44454489
# Merge another branch into the current one
44464490
git merge <branch>
4447-
# In case of conflict, git shows editor and user must fix it manually
4448-
git add <file with conflict> # Needed to re-add conflicting file
44494491
\end{bashcode}
44504492
\end{frame}
44514493
44524494
\begin{frame}[fragile]{Working with Git --- tags, logs and settings}
44534495
\begin{bashcode}
4496+
# In case of conflict, git shows editor and user must fix it manually
4497+
git add <file with conflict> # Needed to re-add conflicting file
44544498
# To see changes before merging
44554499
git diff <source_branch> <target_branch>
44564500
# Tagging e.g. milestones, released versions of software, etc.
@@ -4467,9 +4511,16 @@ \section{Git} % TODO More general info about Git, separate GitHub to extra slide
44674511
git config format.pretty oneline # Nicer log output
44684512
~/.git # Contains user's settings, .git in every repository contains
44694513
# data and settings for particular repository
4514+
# Default behavior of Git can be heavily altered
44704515
\end{bashcode}
44714516
\end{frame}
44724517
4518+
% \begin{frame}{Git tasks} % TODO Add Git tasks
4519+
% \begin{itemize}
4520+
% \item
4521+
% \end{itemize}
4522+
% \end{frame}
4523+
44734524
\section{Administration}
44744525
44754526
\begin{frame}{Administration}
@@ -4478,7 +4529,7 @@ \section{Administration}
44784529
44794530
% \begin{frame}{Btrfs and Snapper} % TODO Btrfs, Snapper
44804531
% \begin{itemize}
4481-
% \item
4532+
% \item
44824533
% \end{itemize}
44834534
% \end{frame}
44844535
@@ -4528,7 +4579,7 @@ \subsection{System services}
45284579
45294580
% \begin{frame}{Security} % TODO Security, antiviruses
45304581
% \begin{itemize}
4531-
% \item
4582+
% \item
45324583
% \end{itemize}
45334584
% \end{frame}
45344585
@@ -4542,7 +4593,7 @@ \section{The End}
45424593
%
45434594
% \begin{frame}[allowframebreaks]{Brief list of applications to help to switch to Linux}
45444595
% \begin{itemize}
4545-
% \item
4596+
% \item
45464597
% \end{itemize}
45474598
% \end{frame}
45484599

0 commit comments

Comments
 (0)