git ch. 0-3 Flashcards
(44 cards)
What is git?
Command-line tool for managing version control.
Light, efficient, safe/easy recovery, open source.
What is a git repository?
History of project’s versions, files, branches.
What is a commit in git?
History of snapshots of your project.
Contains file contents, metadata, parent pointer(s), and unique commit ID hash.
What is the structure of commit history?
Forms a directed acyclic graph (DAG).
Where is the git repository stored?
Stored locally.
What is the working directory in git?
Where you directly interact with project files. Looks like local version of project.
Modifying a file will move it from unchanged to changed working directory.
What does ‘git add’ do?
Stages changes. Moves things from working directory to staging area.
What is the staging area in git?
Where changes are prepared before committing.
Also known as the index.
What does ‘git commit’ do?
Saves snapshot and moves it from staging area to committed history. Moves head pointer to most recent commit.
What is the relationship between working directory, staging area, and committed history?
Working directory -> git add -> staging area -> git commit -> committed history.
What does HEAD represent in git?
Current working branch.
What is the purpose of ‘git switch’?
Causes HEAD to point to a targeted branch.
What is a detached head state?
When HEAD points to a specific commit instead of a branch.
What is a source branch?
Branch with new changes.
What is a target branch?
Branch being merged into (e.g., main).
Must switch to this branch first.
What is a fast forward merge?
Linear path of commit history. Source branch hasn’t diverged from target branch.
What is a merge commit?
Diverged path where both source and target have new commits.
Creates new commit with 2 parent commits.
What indicates conflicting changes in a merge conflict report?
««««<, ===========,»_space;»»»»».
How can you see which files have conflicts?
Use ‘git status’.
What does ‘git help [command]’ do?
Provides help for the specified command.
What does ‘git config’ do?
Tells git what your name and email is.
git config –global user.name “name”. (the –global indicates that this is applied to all projects)
What does ‘git init’ do?
Turns directory into git repository.
What does ‘git status’ show?
Shows branch, commits, untracked files, tracked files.
What does ‘git log’ do?
View repo commits, outputs each commit’s id hash, author, date, and message.