Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Git course
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
courses
Git course
Commits
2af49b64
Commit
2af49b64
authored
11 years ago
by
Laros
Browse files
Options
Downloads
Patches
Plain Diff
Updated the basics slides.
parent
df0d81df
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
basics/basics.tex
+53
-2
53 additions, 2 deletions
basics/basics.tex
with
53 additions
and
2 deletions
basics/basics.tex
+
53
−
2
View file @
2af49b64
...
...
@@ -43,6 +43,7 @@
Initialized empty Git repository in <path>
/
.git
/
\end
{
lstlisting
}
\bigskip
\pause
Or you can ``clone'' an existing repository.
\bigskip
...
...
@@ -120,6 +121,7 @@
# README
\end{lstlisting}
\bigskip
\pause
\begin{lstlisting}
[language=none, caption=Now the file will be tracked.]
$
git add README
...
...
@@ -146,8 +148,14 @@
This will open an editor, give a short description of the changes you made.
\begin
{
itemize
}
\item
This is u
seful when you want to search
for older versions later
.
\item
U
seful when you want to search.
\end
{
itemize
}
\bigskip
\pause
\begin
{
lstlisting
}
[
language
=
none, caption
=
Commit a new version.
]
$
git commit -m "Solved the counting bug."
\end{lstlisting}
\end{frame}
\begin{frame}
[fragile]
...
...
@@ -164,6 +172,7 @@
# modified: README
\end
{
lstlisting
}
\bigskip
\pause
If you want to undo this, you can use ``
\bt
{
git reset
}
''.
\bigskip
...
...
@@ -215,6 +224,11 @@
\bigskip
The hash can be found with ``
\bt
{
git log
}
''.
\bigskip
\pause
You can also use an unique prefix of this hash, usually six characters is
enough.
\end{frame}
\begin{frame}
[fragile]
...
...
@@ -234,6 +248,15 @@
+Third version.
\end{lstlisting}
\bigskip
\pause
For staged files, use the ``
\bt
{
--cached
}
'' or ``
\bt
{
--staged
}
'' option.
\bigskip
\begin{lstlisting}
[language=none, caption=Difference between the staging area
and the last commit.]
$
git diff
--
cached
\end
{
lstlisting
}
\end
{
frame
}
\begin
{
frame
}
[
fragile
]
...
...
@@ -252,6 +275,12 @@
+Third version.
\end{lstlisting}
\bigskip
\pause
\begin{lstlisting}
[language=none, caption=Difference between two committed
versions.]
$
git diff
8
e
10
be cc
61
ee
\end
{
lstlisting
}
\end
{
frame
}
\section
{
Extras
}
...
...
@@ -261,12 +290,14 @@
Sometimes you do not want to track certain files:
\begin
{
itemize
}
\item
Executables.
\item
\bt
{
pdf
}
files (if you still have the
\LaTeX
source).
\item
\bt
{
pdf
}
files
(
if you still have the
\LaTeX
\
source
)
.
\item
Python bytecode
(
\bt
{
.pyc
}
)
files.
\item
Files containing passwords.
\end
{
itemize
}
\bigskip
\pause
Use the special ``
\bt
{
.gitignore
}
'' file.
\begin
{
lstlisting
}
[
language
=
none, caption
=
Ignoring certain files.
]
$
touch notrack.txt
$
echo notrack.txt > .gitignore
...
...
@@ -277,6 +308,26 @@
\end{lstlisting}
\end{frame}
\begin{frame}
[fragile]
\frametitle
{
Help.
}
With the ``
\bt
{
help
}
'' command get the manual of a particular subcommand.
\bigskip
\begin{lstlisting}
[language=none, caption=Get the full manual.]
$
git help <command>
\end
{
lstlisting
}
\bigskip
\pause
Example.
\bigskip
\begin
{
lstlisting
}
[
language
=
none, caption
=
Get the manual for the diff
subcommand.
]
$
git help diff
\end{lstlisting}
\end{frame}
\section
{
Questions?
}
\lastpagetemplate
\begin{fframe}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment