Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Git course
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
2
Issues
2
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
courses
Git course
Commits
d00c9db7
Commit
d00c9db7
authored
Apr 03, 2018
by
Mihai Lefter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated solutions in practical 2 and refined basics presentation
parent
1342d8b6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
76 additions
and
10 deletions
+76
-10
basics/basics.tex
basics/basics.tex
+74
-8
commit_graph/commit_graph_handouts.tex
commit_graph/commit_graph_handouts.tex
+2
-2
No files found.
basics/basics.tex
View file @
d00c9db7
...
...
@@ -147,10 +147,21 @@
\href
{
http://git-scm.com/book/en/v2/Getting-Started-Git-Basics
}
{
Pro Git Book
}
.
}}
:
\begin{center}
\includegraphics
[width=0.
85\textwidth]
{
images/file
_
status
_
cycles
.pdf
}
\\
\includegraphics
[width=0.
75\textwidth]
{
images/file
_
status
_
cycles
_
00
.pdf
}
\\
\end{center}
\end{pframe}
\begin{pframe}
Git itself will associate your files with various
\textbf
{
states
}
\footnote
[1]
{
\scriptsize
{
Adapted from the
\href
{
http://git-scm.com/book/en/v2/Getting-Started-Git-Basics
}
{
Pro Git Book
}
.
}}
:
\begin{center}
\includegraphics
[width=0.75\textwidth]
{
images/file
_
status
_
cycles
_
01.pdf
}
\\
\end{center}
\end{pframe}
\subsection
{
Adding/staging files
}
\begin{pframe}
To start tracking the file, we need to stage it first:
...
...
@@ -174,6 +185,19 @@
Note also that the file is now in the
\stagedfile
{
staging area
}
.
\end{pframe}
\begin{pframe}
To start tracking the file, we need to stage it first:
\vspace
{
-0.4cm
}
\begin{framed}
\prompt\ \gitcmd\ \cmd
{
add
}
\ \cmdarg
{
README
}
\
\end{framed}
We can see that the state of the file has changed:
\begin{center}
\includegraphics
[width=0.75\textwidth]
{
images/file
_
status
_
cycles
_
add.pdf
}
\\
\end{center}
\end{pframe}
\subsection
{
Commit
}
\begin{pframe}
\vspace
{
-0.4cm
}
...
...
@@ -199,6 +223,20 @@
\end{framed}
\end{pframe}
\begin{pframe}
\vspace
{
-0.4cm
}
\begin{framed}
\prompt\ \gitcmd\ \cmd
{
commit
}
\ \cmdopt
{
-m
}
\cmdarg
{
"First commit"
}
\\
\cliout
{
[
}
\branch
{
master
}
\ \commit
{
5466170
}
\cliout
{
] First commit
}
\\
\cliout
{
1 file changed, 1 insertion(+)
}
\\
\cliout
{
create mode 100644 README
}
\end{framed}
\begin{center}
\includegraphics
[width=0.75\textwidth]
{
images/file
_
status
_
cycles
_
commit.pdf
}
\\
\end{center}
\end{pframe}
\subsection
{}
\begin{pframe}
\vspace
{
-0.5cm
}
...
...
@@ -222,6 +260,20 @@
\end{framed}
\end{pframe}
\begin{pframe}
\vspace
{
-0.5cm
}
Let's update the file now:
\vspace
{
-0.4cm
}
\begin{framed}
\prompt\ \cmd
{
echo
}
\ \cmdarg
{
"Second version."
}
\ \op
{$
>
$}
\ \cmdarg
{
README
}
\end{framed}
\begin{center}
\includegraphics
[width=0.75\textwidth]
{
images/file
_
status
_
cycles
_
edit.pdf
}
\\
\end{center}
\end{pframe}
\subsection
{
Check the differences
}
\begin{pframe}
\vspace
{
-0.4cm
}
...
...
@@ -297,6 +349,19 @@
\end{pframe}
\subsection
{
Unstage
}
\begin{pframe}
% \vspace{-0.5cm}
\begin{framed}
\prompt\ \cmd
{
echo
}
\ \cmdarg
{
"Some mistake"
}
\op
{$
>>
$}
\ \cmdarg
{
README
}
\\
\prompt\ \gitcmd\ \cmd
{
add
}
\ \cmdarg
{
README
}
\\
\prompt\ \gitcmd\ \cmd
{
reset
}
\ \textcolor
{
head
}{
\lstinline
{
HEAD
}}
\cmdarg
{
README
}
\end{framed}
\begin{center}
\includegraphics
[width=0.75\textwidth]
{
images/file
_
status
_
cycles
_
reset.pdf
}
\\
\end{center}
\end{pframe}
\subsection
{
Check commit history
}
\begin{pframe}
% \vspace{-0.5cm}
...
...
@@ -313,8 +378,7 @@
\end{framed}
\end{pframe}
\section
{
Restoring Previous Versions
}
\subsection
{
Checkout
}
\subsection
{
Restoring Previous Versions
}
\begin{pframe}
One that is used quite commonly is to discard a
\modifiedfile
{
working directory
}
\
file changes and
\textbf
{
restore its latest repository state
}
:
...
...
@@ -328,6 +392,13 @@
\begin{framed}
\prompt\ \gitcmd\ \cmd
{
checkout
}
\ \cmdopt
{
--
}
\ \cmdarg
{
.
}
\end{framed}
\pause
\begin{center}
\includegraphics
[width=0.75\textwidth]
{
images/file
_
status
_
cycles
_
checkout.pdf
}
\\
\end{center}
\end{pframe}
\begin{pframe}
To retrieve a file from a specific commit into the
\stagedfile
{
staging area
}
:
\vspace
{
-0.4cm
}
\begin{framed}
...
...
@@ -335,11 +406,6 @@
\end{framed}
\end{pframe}
% \subsection{Revert}
% \begin{pframe}
%
% \end{pframe}
\section
{
Extras
}
\subsection
{
Explicit not tracking
}
...
...
commit_graph/commit_graph_handouts.tex
View file @
d00c9db7
...
...
@@ -310,8 +310,8 @@ Next, you will make some file changes and manipulate the commit graph even furth
\begin{multicols}
{
6
}
\begin{itemize}
\item
1.1 -
d
\item
1.2 -
c
\item
1.1 -
c
\item
1.2 -
f
\item
1.3 - c
\item
1.4 - d
\item
1.5 - d
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment