Commit 61e819fe authored by Grégory Mounié's avatar Grégory Mounié
Browse files

détails de l'exploration des données

parent dd880d68
......@@ -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) aac95f0] 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 eee2e0b] 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
* eee2e0b (HEAD -> master) second commit
* aac95f0 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 SHA1_DE_MASTER
git cat-file -p SHA1_DE_TREE # notez le SHA1 de myfile.txt
git cat-file -p SHA1_DE_SUBDIR
git cat-file -p SHA1_DE_subfile.txt # identique au SHA1 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 b4 e2 e6 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 eee2e0b4bf68f4dc0e0f73bc6594736253206397 # ou eee2e
tree af6f7952b127efa16e7e60d3e39597107e3c19ce
parent aac95f06950b585f28c9027429fb806e22f55e30
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 e2aa7703c36797d761b847d5cf9bf70098487ce0
100644 blob e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 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}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment