Skip to content

Commit

Permalink
minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
brownsarahm committed Oct 27, 2023
1 parent d7c115e commit 597fa45
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 18 deletions.
46 changes: 30 additions & 16 deletions notes/2023-10-12.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ Also, looking at the parts of git is a good way to reinforce specific design pat

Let's look at the github inclass repo.

```
```{code-cell} bash
:tags: ["skip-execution"]
cd Documents/inclass/systems/github-inclass-fa23-brownsarahm/
```

Expand Down Expand Up @@ -330,7 +331,6 @@ There are 3 types:


```{mermaid}
classDiagram
class tree{
List:
Expand Down Expand Up @@ -780,7 +780,8 @@ Hashing the content does not change the status here at all, because `git status`
## Writing a tree

Now we can write a tre and it will have content.
```
```{code-cell} bash
:tags: ["skip-execution"]
git write-tree
```

Expand All @@ -789,7 +790,8 @@ d8329fc1cc938780ffdd9f94e0d364e0ea74f579
```

Lets examine the tree, first check the type
```
```{code-cell} bash
:tags: ["skip-execution"]
git cat-file -t d832
```

Expand All @@ -798,7 +800,8 @@ tree
```

and now we can look at its contents
```
```{code-cell} bash
:tags: ["skip-execution"]
git cat-file -p d832
```

Expand Down Expand Up @@ -840,7 +843,8 @@ This only keeps track of th objects, there are also still the HEAD that we have

Now two of our objects are linked! the tree points to the blob of the first version of the file. We are getting closer to what would happend when we make a commit with a porcelain command.

```
```{code-cell} bash
:tags: ["skip-execution"]
git status
```

Expand All @@ -867,7 +871,8 @@ Changes not staged for commit:
We can echo a commit message through a pipe into the commit-tree plumbing function to commit a particular hashed object.


```
```{code-cell} bash
:tags: ["skip-execution"]
echo "first commit" | git commit-tree d8329
```

Expand All @@ -886,7 +891,8 @@ You can find the hash of your commit object later by comparing to mine and getti

We can also look at its type

```
```{code-cell} bash
:tags: ["skip-execution"]
git cat-file -t 0ec6
```

Expand All @@ -896,7 +902,8 @@ commit

and we can look at the content

```
```{code-cell} bash
:tags: ["skip-execution"]
git cat-file -p 0ec6
```

Expand All @@ -911,7 +918,8 @@ first commit

Now we check the final status of our repo

```
```{code-cell} bash
:tags: ["skip-execution"]
git status
```

Expand Down Expand Up @@ -994,7 +1002,8 @@ In our case because we made the commit manually, we did not update the branch.


We can verify by looking at the `HEAD` file
```
```{code-cell} bash
:tags: ["skip-execution"]
cat .git/HEAD
```

Expand All @@ -1003,7 +1012,8 @@ ref: refs/heads/main
```

and see that:
```
```{code-cell} bash
:tags: ["skip-execution"]
cat .git/refs/heads/main
```

Expand All @@ -1015,7 +1025,8 @@ which does not even exist!

we can see the objects though:

```
```{code-cell} bash
:tags: ["skip-execution"]
find .git/objects/ -type f
```

Expand All @@ -1031,12 +1042,14 @@ find .git/objects/ -type f
and we can create that file by putting the full hash of the commit into the file


```
```{code-cell} bash
:tags: ["skip-execution"]
echo 0ec6f39c964a3149d426ae45bef4385e14444b2c > .git/refs/heads/main
```

so that
```
```{code-cell} bash
:tags: ["skip-execution"]
cat .git/refs/heads/main
```

Expand All @@ -1048,7 +1061,8 @@ shows the hash:
Now we check status and we are all set!


```
```{code-cell} bash
:tags: ["skip-execution"]
git status
```

Expand Down
5 changes: 3 additions & 2 deletions notes/2023-10-17.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,15 @@ An attacker who gets one of those databases, cannot actually read the passwords,
+++


```
```{code-cell} bash
:tags: ["skip-execution"]
echo "password" | git hash-object --stdin
```

+++


```
```{code-block} console
f3097ab13082b70f67202aab7dd9d1b35b7ceac2
```

Expand Down

0 comments on commit 597fa45

Please sign in to comment.