Notes on git tags and refs.

c-declarations
Joshua Potter 2024-03-22 09:23:16 -06:00
parent 091521c382
commit be383ef6d5
3 changed files with 149 additions and 5 deletions

View File

@ -231,7 +231,7 @@
"_journal/2024-02/2024-02-27.md": "f75a0d04a875aeee932343dae0c78768", "_journal/2024-02/2024-02-27.md": "f75a0d04a875aeee932343dae0c78768",
"filesystems/index.md": "cbd2b0290a3ba3b32abec4bd8bfefad5", "filesystems/index.md": "cbd2b0290a3ba3b32abec4bd8bfefad5",
"filesystems/cas.md": "34906013a2a60fe5ee0e31809b4838aa", "filesystems/cas.md": "34906013a2a60fe5ee0e31809b4838aa",
"git/objects.md": "e9b98576291ca04496c2f0863f526cfa", "git/objects.md": "43d825371e820802f2402034fad89480",
"git/index.md": "83d2d95fc549d9e8436946c7bd058d15", "git/index.md": "83d2d95fc549d9e8436946c7bd058d15",
"encoding/integer.md": "d4866b6e236c3a67631d03582996eca2", "encoding/integer.md": "d4866b6e236c3a67631d03582996eca2",
"_journal/2024-02-29.md": "f610f3caed659c1de3eed5f226cab508", "_journal/2024-02-29.md": "f610f3caed659c1de3eed5f226cab508",
@ -298,10 +298,11 @@
"x86-64/index.md": "4769ab45ca374c4225c9c4099220be82", "x86-64/index.md": "4769ab45ca374c4225c9c4099220be82",
"_journal/2024-03-21.md": "a2572d2d5be0ee7c7f066d846e2f3e77", "_journal/2024-03-21.md": "a2572d2d5be0ee7c7f066d846e2f3e77",
"_journal/2024-03/2024-03-20.md": "0a73ce399d275fe6ee3134a812f3f4f9", "_journal/2024-03/2024-03-20.md": "0a73ce399d275fe6ee3134a812f3f4f9",
"_journal/2024-03-22.md": "6c14bacf3e8834359f8512b7d7055acc", "_journal/2024-03-22.md": "8da8cda07d3de74f7130981a05dce254",
"_journal/2024-03/2024-03-21.md": "cd465f71800b080afa5c6bdc75bf9cd3", "_journal/2024-03/2024-03-21.md": "cd465f71800b080afa5c6bdc75bf9cd3",
"x86-64/declarations.md": "60f5b240ea5565b33dc3585169fc41b1", "x86-64/declarations.md": "60f5b240ea5565b33dc3585169fc41b1",
"x86-64/instructions.md": "c4b116179d2bd1f9510437e000f9c63d" "x86-64/instructions.md": "c4b116179d2bd1f9510437e000f9c63d",
"git/refs.md": "de99450b5a4282ae1a694492f2b7f251"
}, },
"fields_dict": { "fields_dict": {
"Basic": [ "Basic": [

View File

@ -517,6 +517,107 @@ Reference: Scott Chacon, *Pro Git*, Second edition, The Experts Voice in Soft
<!--ID: 1709674569928--> <!--ID: 1709674569928-->
END%% END%%
## Tags
Tags are (possibly indirect) pointers to a git object. They *usually* point to a commit but aren't required to. There are two types of tags:
* **Lightweight** tags are [[refs|git refs]] that never move. These aren't really git objects in the same way the other objects are.
* **Annotated** tags are real objects that provide metadata about the object being pointed to.
%%ANKI
Cloze
{1:Lightweight} tags are to git {2:refs} whereas {2:annotated} tags are to git {1:objects}.
Reference: Scott Chacon, *Pro Git*, Second edition, The Experts Voice in Software Development (New York, NY: Apress, 2014).
<!--ID: 1711120782248-->
END%%
%%ANKI
Basic
Creation of which of lightweight and/or annotated tags writes a new ref to disk?
Back: Both.
Reference: Scott Chacon, *Pro Git*, Second edition, The Experts Voice in Software Development (New York, NY: Apress, 2014).
<!--ID: 1711120977416-->
END%%
%%ANKI
Basic
Creation of which of lightweight and/or annotated tags writes a new object to disk?
Back: Just annotated tags.
Reference: Scott Chacon, *Pro Git*, Second edition, The Experts Voice in Software Development (New York, NY: Apress, 2014).
<!--ID: 1711120977419-->
END%%
%%ANKI
Basic
What two kinds of git tags are there?
Back: Lightweight and annotated.
Reference: Scott Chacon, *Pro Git*, Second edition, The Experts Voice in Software Development (New York, NY: Apress, 2014).
<!--ID: 1711120782251-->
END%%
%%ANKI
Basic
What do git tags point to?
Back: Any git object.
Reference: Scott Chacon, *Pro Git*, Second edition, The Experts Voice in Software Development (New York, NY: Apress, 2014).
<!--ID: 1711120782253-->
END%%
%%ANKI
Basic
What do git tags *usually* point to?
Back: Commits.
Reference: Scott Chacon, *Pro Git*, Second edition, The Experts Voice in Software Development (New York, NY: Apress, 2014).
<!--ID: 1711120782256-->
END%%
%%ANKI
Basic
What primitive type does a lightweight tag correspond to?
Back: A git ref.
Reference: Scott Chacon, *Pro Git*, Second edition, The Experts Voice in Software Development (New York, NY: Apress, 2014).
<!--ID: 1711120782258-->
END%%
%%ANKI
Basic
What primitive type does an annotated tag correspond to?
Back: A git object.
Reference: Scott Chacon, *Pro Git*, Second edition, The Experts Voice in Software Development (New York, NY: Apress, 2014).
<!--ID: 1711120782261-->
END%%
%%ANKI
Basic
How many pointers does a lightweight tag introduce?
Back: One.
Reference: Scott Chacon, *Pro Git*, Second edition, The Experts Voice in Software Development (New York, NY: Apress, 2014).
<!--ID: 1711120782264-->
END%%
%%ANKI
Basic
How many pointers does an annotated tag introduce?
Back: Two.
Reference: Scott Chacon, *Pro Git*, Second edition, The Experts Voice in Software Development (New York, NY: Apress, 2014).
<!--ID: 1711120782267-->
END%%
%%ANKI
Basic
Why is the term "tag object" a slight misnomer?
Back: A lightweight tag is just a ref, not an object.
Reference: Scott Chacon, *Pro Git*, Second edition, The Experts Voice in Software Development (New York, NY: Apress, 2014).
<!--ID: 1711120782269-->
END%%
%%ANKI
Cloze
Git objects are to {`.git/objects`} whereas git references are to {`.git/refs`}.
Reference: Scott Chacon, *Pro Git*, Second edition, The Experts Voice in Software Development (New York, NY: Apress, 2014).
<!--ID: 1711120782272-->
END%%
## References ## References
* Scott Chacon, *Pro Git*, Second edition, The Experts Voice in Software Development (New York, NY: Apress, 2014). * Scott Chacon, *Pro Git*, Second edition, The Experts Voice in Software Development (New York, NY: Apress, 2014).

View File

@ -1,5 +1,5 @@
--- ---
title: References title: Refs
TARGET DECK: Obsidian::STEM TARGET DECK: Obsidian::STEM
FILE TAGS: git FILE TAGS: git
tags: tags:
@ -8,7 +8,11 @@ tags:
## Overview ## Overview
A **reference** is essentially a file containing an oid. The name of the file can then be used to reference the oid. A **symbolic reference** is a file containing the name of another reference. A **reference** (or **ref**) is essentially a file containing an oid. The name of the file can then be used to reference the oid. A **symbolic reference** is a file containing the name of another reference. The primary refs are:
* heads (i.e. branches)
* remotes (i.e. remote branches)
* [[objects#Tags|tags]]
%%ANKI %%ANKI
Basic Basic
@ -50,6 +54,13 @@ Reference: Scott Chacon, *Pro Git*, Second edition, The Experts Voice in Soft
<!--ID: 1710454031271--> <!--ID: 1710454031271-->
END%% END%%
%%ANKI
Basic
Where on disk are git remote branch refs stored?
Back: `.git/refs/remotes`
Reference: Scott Chacon, *Pro Git*, Second edition, The Experts Voice in Software Development (New York, NY: Apress, 2014).
END%%
%%ANKI %%ANKI
Basic Basic
Where on disk are git remote branch refs stored? Where on disk are git remote branch refs stored?
@ -192,6 +203,37 @@ Reference: Scott Chacon, *Pro Git*, Second edition, The Experts Voice in Soft
<!--ID: 1710454758079--> <!--ID: 1710454758079-->
END%% END%%
%%ANKI
Cloze
Branches are to {`refs/heads`} whereas remote branches are to {`refs/remotes`}.
Reference: Scott Chacon, *Pro Git*, Second edition, The Experts Voice in Software Development (New York, NY: Apress, 2014).
<!--ID: 1711120782236-->
END%%
%%ANKI
Basic
What is the primary distinction between local branch refs and remotes?
Back: The remotes are considered read-only.
Reference: Scott Chacon, *Pro Git*, Second edition, The Experts Voice in Software Development (New York, NY: Apress, 2014).
<!--ID: 1711120782238-->
END%%
%%ANKI
Basic
What safeguard does git employ to keep remotes read-only?
Back: It never updates `HEAD` to point to a remote ref.
Reference: Scott Chacon, *Pro Git*, Second edition, The Experts Voice in Software Development (New York, NY: Apress, 2014).
<!--ID: 1711120782241-->
END%%
%%ANKI
Basic
What is prevented by git never updating `HEAD` to a remote ref?
Back: One can't update the remote ref with a commit.
Reference: Scott Chacon, *Pro Git*, Second edition, The Experts Voice in Software Development (New York, NY: Apress, 2014).
<!--ID: 1711120782244-->
END%%
## References ## References
* Scott Chacon, *Pro Git*, Second edition, The Experts Voice in Software Development (New York, NY: Apress, 2014). * Scott Chacon, *Pro Git*, Second edition, The Experts Voice in Software Development (New York, NY: Apress, 2014).