Please select random order or first card below to begin studying 🤓
Congratulations! You have finished studying this set of cards
Where is all of the Git repository data stored for a project (in the filesystem)?
At the root of your project in the .git directory
The term blob is a contraction of what?
Binary large object
What are the two main data structures that Git stores in the .git directory at the root of your project?
The object store and the index
Of the two primary data structures managed by Git, which is designed to be efficiently copied during a clone?
The object store
Of the two primary data structures managed by Git, which is private to a repository?
The index
What are the four types of objects in the Git object store?
Blobs, trees, commits, and tags
What are the four atomic data types that form all of Git's higher level data structures?
Blobs, trees, commits, and tags
Git represents every version of each file as what type of object?
Blob
What is a common term in computing that refers to a variable or file that can contain any data and whose internal structure is ignored?
Blob
What does a Git blob represent?
A file
Does a Git blob representing a file have the file's name?
No, the blob has no metadata about the file, only the file's data
What does a Git tree object represent?
A directory
What does a Git commit point to that represents the snapshot of the repository at the time the commit was performed?
A tree
What does a Git commit represent?
Metadata about a change introduced into the repository (author, date, log message)
What does a Git tag represent?
An arbitrary name assigned to a different Git object
What Git object represents one level of directory information?
A tree
Since a Git tree object represents a directory which can contain files and directories, what two types of Git objects does a Git tree reference?
Trees and blobs
What Git object holds metadata for each change introduced into the repository like author, commit date, and log message?
Commit
Each Git commit points to what type of object that captures a complete snapshot of the repo at that commit?
A tree
What is the Git commit that has no parent?
The initial/root commit
Can a Git commit have more than one parent?
Yes
What is the Git object type that assigns an arbitrary name to another Git object?
A tag
What type of files does Git use to make use of disk space efficiently, that involve computing diffs between similar files instead of storing every version of every file?
Pack files
What is the temporary and dynamic binary file used by Git that describes the entire structure of the repo, is where changes are staged, and plays an important role in merges?
The index
What are the two primary data structures managed by Git within a Git repository?
The object store and the index
How many bits is a SHA1 value?
160 bits
SHA1 values are usually represented by hexadecimal numbers with how many digits?
40
Why is the SHA1 hash used by Git essentially a globally unique identifier?
Even the tiniest change in the file content will cause it its value to change
What data type is at the bottom of the Git data structure and its objects do not reference anything?
Blobs
What Git data types do tree objects point to?
Trees and blobs
How is it that the same Git tree can by pointed to by different commits?
The content of the repo can be the same for multiple commits
In Git, what can be thought of as the set of intended modifications?
The index
Linus Torvalds once argued on the Git mailing list that Git cannot be appreciated without understanding the purpose of what?
The index
What are you querying the state of when using the git status command?
The index
What command can be used to query the state of the Git index at any time?
git status
What are the three categories that Git classifies your files into?
Tracked, ignored, untracked
Git considers files that are already in the repository or staged in the index to be what?
Tracked
Git considers files that are explicitly declare invisible to be what?
Ignored
Git considers files that are not in the repository or staged, and also not being explicitly ignored, to be what?
Untracked
What Git command converts an untracked file to a tracked one?
git add
What is the special file to Git that is used to declare what files are to be ignored?
.gitignore
What command is the inverse of git add?
git rm
What is the Git command to remove a file from the index, but leave it in the working directory?
git rm --cached
What is the Git command to remove a file from the index and also remove it from the working directory?
git rm
What is the command to remove a file that has not been staged from the working directory?
rm
In a .gitignore file, what marks a directory name?
A trailing slash (/)
What converts the virtual tree object that is in the Git index to a real tree object placed in the object store under its SHA1 value, as well as creates a commit object pointing to the tree and previous commit(s)?
A commit
Where does Git place a snapshot of the index when a commit occurs?
The object store
What is the only method of introducing changes to a Git repo?
A commit
What operation causes Git to record a snapshot of the index and place that snapshot in the object store as a tree?
A commit
What is the only means to introduce changes into a Git repository?
A commit
What is the most rigorous name for a Git commit?
The SHA1/hash ID
What term refers to an SHA1 hash ID that refers to an object within the Git object store?
A ref
What type of ref is a name that indirectly points to a Git object?
A symref
What are refs that indirectly point to Git objects (rather than directly) and include HEAD, ORIG_HEAD, etc.?
Symrefs
HEAD, ORIG_HEAD, FETCH_HEAD, are examples of these types of refs that indirectly points to Git objects, usually commits?
symrefs (symbolic references)
What is the special Git symref that updates automatically to refer to the latest commit when you change branches?
HEAD
What is the special symref maintained by Git automatically that refers to the latest commit on the current branch?
HEAD
If a Git commit has three parents, how can the three parent commits be referred to as (relative commit names)?
C^1, C^2, C^3
How can the parent, grandparent, and great-grandparent commits of a git commit be referred to as (relative commit names)?
C~1, C~2, C~3
In Computer Science, what is a collection of nodes and a set of edges between the nodes?
A graph
What is the special type of graph that is used by Git, where all edges are directed, and no path along the directed edges leads back to the starting node?
A directed acyclic graph (DAG)
What is the type of graph that Git uses to implement the history of commits?
A directed acyclic graph
What are the two important properties of a directed acyclic graph noted in the Version Control with Git book?
All edges are directed and there is no path along the directed edges that lead back to the starting node
What is the git command that can be used to systematically isolate and determine a commit that introduced a problem using a clever divide and conquer algorithm?
git bisect
What is the fundamental means of launching a separate line of development in a software project?
A branch
What determines what files are checked out in the working directory of a Git repository?
The current branch
How many current branches can there by in a Git repository at any one time?
1
What is the most recent commit on a branch called?
The head
What is the command to introduce a new branch to the repo?
git branch
What does the git branch command do when used with no arguments?
Lists the branch names
What git command can also be used to view the branches (like git branch does) but provides more detailed output?
git show-branch
What is the Git command that changes the current branch?
git checkout
What is the anonymous branch Git creates for you when you check out a random commit called?
A detached HEAD
What options can be used with the git branch command to delete a branch?
-d or -D
If you delete a branch with the -D option and then realize you want to get a commit that is gone back, where should you turn?
The reflog
What Git operation unifies two or more branches?
A merge
Does Git support merging more than two branches at the same time?
Yes
When a Git merge happens, what branch gets the merge commit?
The current branch
What should you always make sure before you do a merge with Git?
Make sure your working directory and index are clean
What option can you pass to git log to see a nice visual that is an alternative to graphical tools such as gitk?
git log --graph
What Git command can find the merge base between branches?
git merge-base
What are the two degenerate merge scenarios that do not introduce a new merge commit?
Already up-to-date and fast-forward
What is the degenerate Git merge scenario where all the commits from the other branch are already present in the target branch?
Already up-to-date
What is the degenerate Git merge scenario where your branch is already fully present in the other branch and so the new commits are tacked on to the current branch?
Fast-forward
What are the three normal merge strategies that produce a merge commit added to the currently checked out branch?
Resolve, recursive, and octopus
What is the normal merge strategy that locates the merge base and applies changes from the merge base to the top of the other branch HEAD onto the current branch?
Resolve
What is the normal merge strategy that merges two branches but can work when there is more than one possible merge base?
Recursive
What is the normal merge strategy that temporarily merges the possible merge bases to use as the merge base to derive the resulting merge?
Recursive
What is the normal merge strategy that internally uses the recursive strategy but can merge more than two branches at once?
Octopus
When can the octopus Git merge strategy not work?
If conflict resolution is needed
What are the two special merge strategies discussed in the Version Control with Git book?
ours and subtree
Does a merge commit represent any branch more than any other branch when they are merged together?
No
What is a reason why it is probably preferable to do a merge rather than create a linear history (rebase) according to the Version Control with Git book?
The rebase introduces intermediate states that were never really looked at
What does this command do?
git reset --soft commit
Changes the HEAD ref to point to commit
What does this command do?
git reset --hard commit
Changes the HEAD ref to point to commit, changes the contents of the index to match with the commit's tree structure, and changes the working directory to reflect the same tree structure
What is the Git command to save the current index and working directory as an independent commit accessible through the ref refs/stash?
git stash save
What is the Git command that restores the context saved by a git stash save command?
git stash pop
What common data structure is closely related to the git stash save and git stash pop commands?
Stack
What Git concept is a record of changes that is updated any time an update is made to any ref?
The reflog
How many refs does the reflog show you relevant operations for at one time?
1
When using the git reflog show command, what is the default ref?
HEAD
What does Git have which comes in handy when you are confused at what just happened or when you just did some operation you regret?
The reflog