git ch. 0-3 Flashcards

1
Q

What is git?

A

Command-line tool for managing version control.

Light, efficient, safe/easy recovery, open source.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is a git repository?

A

History of project’s versions, files, branches.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is a commit in git?

A

History of snapshots of your project.

Contains file contents, metadata, parent pointer(s), and unique commit ID hash.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the structure of commit history?

A

Forms a directed acyclic graph (DAG).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Where is the git repository stored?

A

Stored locally.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is the working directory in git?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What does ‘git add’ do?

A

Stages changes. Moves things from working directory to staging area.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is the staging area in git?

A

Where changes are prepared before committing.

Also known as the index.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What does ‘git commit’ do?

A

Saves snapshot and moves it from staging area to committed history. Moves head pointer to most recent commit.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is the relationship between working directory, staging area, and committed history?

A

Working directory -> git add -> staging area -> git commit -> committed history.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What does HEAD represent in git?

A

Current working branch.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is the purpose of ‘git switch’?

A

Causes HEAD to point to a targeted branch.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is a detached head state?

A

When HEAD points to a specific commit instead of a branch.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is a source branch?

A

Branch with new changes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is a target branch?

A

Branch being merged into (e.g., main).

Must switch to this branch first.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is a fast forward merge?

A

Linear path of commit history. Source branch hasn’t diverged from target branch.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What is a merge commit?

A

Diverged path where both source and target have new commits.

Creates new commit with 2 parent commits.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

What indicates conflicting changes in a merge conflict report?

A

««««<, ===========,&raquo_space;»»»»».

19
Q

How can you see which files have conflicts?

A

Use ‘git status’.

20
Q

What does ‘git help [command]’ do?

A

Provides help for the specified command.

21
Q

What does ‘git config’ do?

A

Tells git what your name and email is.

git config –global user.name “name”. (the –global indicates that this is applied to all projects)

22
Q

What does ‘git init’ do?

A

Turns directory into git repository.

23
Q

What does ‘git status’ show?

A

Shows branch, commits, untracked files, tracked files.

24
Q

What does ‘git log’ do?

A

View repo commits, outputs each commit’s id hash, author, date, and message.

25
Q

What does ‘git log –graph –oneline’ do?

A

Visualizes commit history with branch relationships.

26
Q

What does ‘git stash’ do?

A

Temporarily stashes away changes to focus on other tasks or branches.

27
Q

What does ‘git stash pop’ do?

A

Recovers stash changes to current working directory.

28
Q

What does ‘git restore’ do?

A

Undo file change.

29
Q

you missed this on your first qz00 try

What does ‘git restore –staged [file]’ do?

A

Unstage changed file.

30
Q

What does ‘git checkout [commit hash] – [file]’ do?

A

recovers a file from its previous commit

31
Q

What does ‘git checkout [commit hash]’ do?

A

temporarily view or test a specific commit without creating a new branch

this is in a detached head state

32
Q

What does ‘git checkout [branch]’ do?

A

Switches to specific branch.

33
Q

What does ‘git checkout -b [new branch name]’ do?

A

Creates and switches to new branch.

34
Q

What does ‘git branch’ do?

A

Create, list, delete branches.

git branch -c [name] creates. git branch lists. git branch -d [name] deletes.

35
Q

What does ‘git branch -d’ do?

A

Safe delete merged branches.

36
Q

What does ‘git switch’ do?

A

Switch between branches.

37
Q

What does ‘git switch –create [branch name]’ do?

A

Creates and switches to new branch.

38
Q

What does ‘git merge’ do?

A

Combine changes from one branch into another.

39
Q

What does ‘git merge –abort’ do?

A

Cancel merge and return to pre-merge conflict state.

40
Q

echo [message]&raquo_space; [file]

A

appends text to file contents without overwriting

41
Q

git restore [file]

A

gets rid of changes in working directory for the file

42
Q

what are the different ways to create branches?

A

git switch -c [branch name] OR git checkout -b [branch name]. git branch [name].

43
Q

git config –list

A

verifies current configuration. shows all variables in config file, like user.name and user.email

44
Q

what are branches, conceptually

A

pointers to commits that update as new commits are added (depending on HEAD)