Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Gregory Mounie
formation-git
Commits
61e819fe
Commit
61e819fe
authored
Jan 07, 2020
by
Grégory Mounié
Browse files
détails de l'exploration des données
parent
dd880d68
Changes
1
Hide whitespace changes
Inline
Side-by-side
Ensimag_Advanced1h30/advanced1h30.tex
View file @
61e819fe
...
...
@@ -171,14 +171,17 @@ you@laptop$ git shortlog -s --no-merges | sort -nr | head -26
Create a simple repository with two files in
2
commits, one of the
file in a sub
-
directory.
\begin
{
minted
}{
bash
}
mkdir MyRepo.git
cd MyRepo.git
git init .
touch myfile.txt
git add myfile.txt
git commit
-
m "first commit"
...
\footnotesize
\begin
{
minted
}{
console
}
you@laptop
$
mkdir MyRepo.git
you@laptop
$
cd MyRepo.git
you@laptop
$
git init .
you@laptop
$
touch myfile.txt
you@laptop
$
git add myfile.txt
you@laptop
$
git commit
-
m "first commit"
[
master
(
commit racine
)
aac
95
f
0
]
first commit
1
file changed,
0
insertions
(+)
,
0
deletions
(-)
create mode
100644
myfile.txt
\end
{
minted
}
\end
{
exampleblock
}
\end
{
frame
}
...
...
@@ -190,14 +193,19 @@ you@laptop$ git shortlog -s --no-merges | sort -nr | head -26
Create a simple repository with two files in
2
commits, one of the
file in a sub
-
directory.
\begin
{
minted
}{
bash
}
...
mkdir Subdir
touch Subdir
/
mysubfile.txt
git add Subdir
/
mysubfile.txt
git commit
-
m "second commit"
git config
--
local alias.lg "log
--
all
--
graph
--
oneline" # Bonus
git lg
\footnotesize
\begin
{
minted
}{
console
}
you@laptop
$
mkdir Subdir
you@laptop
$
touch Subdir
/
mysubfile.txt
you@laptop
$
git add Subdir/mysubfile.txt
you@laptop
$
git commit
-
m "second commit"
[
master eee
2
e
0
b
]
second commit
1
file changed,
0
insertions
(+)
,
0
deletions
(-)
create mode
100644
Subdir
/
mysubfile.txt
you@laptop
$
git config --local alias.lg "log --all --graph --oneline" # Bonus
you@laptop
$
git lg
*
eee
2
e
0
b
(
HEAD
-
> master
)
second commit
*
aac
95
f
0
first commit
\end
{
minted
}
\end
{
exampleblock
}
\end
{
frame
}
...
...
@@ -217,20 +225,55 @@ you@laptop$ git shortlog -s --no-merges | sort -nr | head -26
Let's explore the data model of
\texttt
{
.git
}
!
\end
{
frame
}
% détailler ce slide
\begin
{
frame
}
[
fragile
]
\frametitle
{
Where is the last commit ? What does it contain ?
}
\begin
{
exampleblock
}{
Data exploration
}
\begin
{
minted
}{
bash
}
ls .git
cat .git
/
HEAD
cat .git
/
refs
/
heads
/
master
ls
-
lR .git
/
objects
/
git cat
-
file
-
p SHA
1
_
DE
_
MASTER
git cat
-
file
-
p SHA
1
_
DE
_
TREE # notez le SHA
1
de myfile.txt
git cat
-
file
-
p SHA
1
_
DE
_
SUBDIR
git cat
-
file
-
p SHA
1
_
DE
_
subfile.txt # identique au SHA
1
de subfile.txt
\begin
{
exampleblock
}{
Data exploration
1
/
3
}
\footnotesize
\begin
{
minted
}{
console
}
you@laptop
$
ls -F .git
branches/ COMMIT
_
EDITMSG config description HEAD hooks/ index info/ logs/ objects/ refs/
you@laptop
$
cat .git
/
HEAD
ref: refs
/
heads
/
master
you@laptop
$
cat .git/refs/heads/master
eee2e0b4bf68f4dc0e0f73bc6594736253206397
you@laptop
$
ls .git
/
objects
/
aa af b
4
e
2
e
6
ee info pack
you@laptop
$
ls .git/objects/ee
e2e0b4bf68f4dc0e0f73bc6594736253206397
\end{minted}
\end{exampleblock}
\end{frame}
\begin{frame}
[fragile]
\frametitle
{
Where is the last commit ? What does it contain ?
}
\begin{exampleblock}
{
Data exploration 2/3
}
\footnotesize
\begin{minted}
{
console
}
you@laptop
$
git cat
-
file
-
p eee
2
e
0
b
4
bf
68
f
4
dc
0
e
0
f
73
bc
6594736253206397
# ou eee
2
e
tree af
6
f
7952
b
127
efa
16
e
7
e
60
d
3
e
39597107
e
3
c
19
ce
parent aac
95
f
06950
b
585
f
28
c
9027429
fb
806
e
22
f
55
e
30
author Grégory Mounié <Gregory.Mounie@imag.fr>
1578330554
+
0100
committer Grégory Mounié <Gregory.Mounie@imag.fr>
1578330554
+
0100
second commit
\end
{
minted
}
\end
{
exampleblock
}
\end
{
frame
}
\begin
{
frame
}
[
fragile
]
\frametitle
{
Where is the last commit ? What does it contain ?
}
\begin
{
exampleblock
}{
Data exploration
3
/
3
}
\footnotesize
\begin
{
minted
}{
console
}
you@laptop
$
git cat-file -p af6f7952b127efa16e7e60d3e39597107e3c19ce
040000 tree e2aa7703c36797d761b847d5cf9bf70098487ce0 Subdir
100644 blob e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 myfile.txt
you@laptop
$
git cat
-
file
-
p e
2
aa
7703
c
36797
d
761
b
847
d
5
cf
9
bf
70098487
ce
0
100644
blob e
69
de
29
bb
2
d
1
d
6434
b
8
b
29
ae
775
ad
8
c
2
e
48
c
5391
mysubfile.txt
you@laptop
$
git cat-file -p e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 # n'affiche rien
\end{minted}
\end{exampleblock}
\end{frame}
...
...
@@ -672,17 +715,17 @@ Explain here WHY your change is good.
\frametitle
{
Dealing with the index
}
\begin{itemize}
\item
Commit only 2 files:
\begin
{
semiverbatim
}
\begin{
minted}
{
bash
}
git add file1.txt
git add file2.txt
git commit # or git gui
\end
{
semiverbatim
}
git commit # or git gui
, magit ...
\end{
minted
}
\item
Commit only some patch hunks:
\begin
{
semiverbatim
}
\begin{
minted}
{
bash
}
git add -p
(answer yes or no for each hunk)
git commit # or git gui
\end
{
semiverbatim
}
git commit # or git gui
, magit ...
\end{
minted
}
\end{itemize}
\end{frame}
...
...
Write
Preview
Supports
Markdown
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