--- title: References TARGET DECK: Obsidian::STEM FILE TAGS: git tags: - git --- ## 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. %%ANKI Basic What is a git ref? Back: A user-friendly name for referring to some git object. Reference: Scott Chacon, *Pro Git*, Second edition, The Expert’s Voice in Software Development (New York, NY: Apress, 2014). END%% %%ANKI Basic How is a git ref realized on disk? Back: It is a file containing an oid. Reference: Scott Chacon, *Pro Git*, Second edition, The Expert’s Voice in Software Development (New York, NY: Apress, 2014). END%% %%ANKI Basic What shorter terminology refers to "git references"? Back: Git refs. Reference: Scott Chacon, *Pro Git*, Second edition, The Expert’s Voice in Software Development (New York, NY: Apress, 2014). END%% %%ANKI Basic Where on disk are git refs stored? Back: In the `.git/refs` directory. Reference: Scott Chacon, *Pro Git*, Second edition, The Expert’s Voice in Software Development (New York, NY: Apress, 2014). END%% %%ANKI Basic Where on disk are git local branch refs stored? Back: `.git/refs/heads` Reference: Scott Chacon, *Pro Git*, Second edition, The Expert’s Voice in Software Development (New York, NY: Apress, 2014). END%% %%ANKI Basic Where on disk are git remote branch refs stored? Back: `.git/refs/remotes` Reference: Scott Chacon, *Pro Git*, Second edition, The Expert’s Voice in Software Development (New York, NY: Apress, 2014). END%% %%ANKI Cloze The {`update-ref`} plumbing command is used to manage {reference files}. Reference: Scott Chacon, *Pro Git*, Second edition, The Expert’s Voice in Software Development (New York, NY: Apress, 2014). END%% %%ANKI Basic Why is the `update-ref` command's name a slight misnomer? Back: It is also used to create references. Reference: Scott Chacon, *Pro Git*, Second edition, The Expert’s Voice in Software Development (New York, NY: Apress, 2014). END%% %%ANKI Basic What plumbing command is used in favor of manually editing reference files? Back: `update-ref` Reference: Scott Chacon, *Pro Git*, Second edition, The Expert’s Voice in Software Development (New York, NY: Apress, 2014). END%% %%ANKI Basic How do I complete the following command to update `master` to the new oid? ```bash $ git update-ref ___ 1a410efbd13591db07496601ebc7a059dd55cfe9 ``` Back: `refs/heads/master` Reference: Scott Chacon, *Pro Git*, Second edition, The Expert’s Voice in Software Development (New York, NY: Apress, 2014). END%% %%ANKI Basic Git (basically) invokes what plumbing command on new branch creation? Back: `update-ref` Reference: Scott Chacon, *Pro Git*, Second edition, The Expert’s Voice in Software Development (New York, NY: Apress, 2014). END%% %%ANKI Basic What is a git symbolic ref? Back: A git ref that points to another ref (as opposed to an oid). Reference: Scott Chacon, *Pro Git*, Second edition, The Expert’s Voice in Software Development (New York, NY: Apress, 2014). END%% %%ANKI Basic Which symbolic ref is most commonly used? Back: `HEAD` Reference: Scott Chacon, *Pro Git*, Second edition, The Expert’s Voice in Software Development (New York, NY: Apress, 2014). END%% %%ANKI Basic What does it mean to be in "detached head state"? Back: `HEAD` refers to an oid instead of another ref. Reference: Scott Chacon, *Pro Git*, Second edition, The Expert’s Voice in Software Development (New York, NY: Apress, 2014). END%% %%ANKI Basic What term describes when `HEAD` is a normal ref instead of a symbolic ref? Back: Detached head state. Reference: Scott Chacon, *Pro Git*, Second edition, The Expert’s Voice in Software Development (New York, NY: Apress, 2014). END%% %%ANKI Basic Where on disk is `HEAD` normally located? Back: `.git/HEAD` Reference: Scott Chacon, *Pro Git*, Second edition, The Expert’s Voice in Software Development (New York, NY: Apress, 2014). END%% %%ANKI Basic What does the contents of `.git/HEAD` normally look like? Back: `ref: refs/heads/` Reference: Scott Chacon, *Pro Git*, Second edition, The Expert’s Voice in Software Development (New York, NY: Apress, 2014). END%% %%ANKI Basic What does the contents of `.git/HEAD` look like in detached head state? Back: `` Reference: Scott Chacon, *Pro Git*, Second edition, The Expert’s Voice in Software Development (New York, NY: Apress, 2014). END%% %%ANKI Basic What plumbing command is used in favor of manually editing symbolic reference files? Back: `symbolic-ref` Reference: Scott Chacon, *Pro Git*, Second edition, The Expert’s Voice in Software Development (New York, NY: Apress, 2014). END%% %%ANKI Cloze Normal refs are to {`update-ref`} whereas symbolic refs are to {`symbolic-ref`}. Reference: Scott Chacon, *Pro Git*, Second edition, The Expert’s Voice in Software Development (New York, NY: Apress, 2014). END%% %%ANKI Cloze The {`symbolic-ref`} plumbing command is used to manage {symbolic reference files}. Reference: Scott Chacon, *Pro Git*, Second edition, The Expert’s Voice in Software Development (New York, NY: Apress, 2014). END%% %%ANKI Basic How do you correctly write the following command? ```bash $ git symbolic-ref HEAD test ``` Back: ```bash $ git symbolic-ref HEAD refs/heads/test ``` Reference: Scott Chacon, *Pro Git*, Second edition, The Expert’s Voice in Software Development (New York, NY: Apress, 2014). END%% ## References * Scott Chacon, *Pro Git*, Second edition, The Expert’s Voice in Software Development (New York, NY: Apress, 2014).