Git Flashcards

(40 cards)

1
Q

What does git init do?

A

It initializes a new Git repository in the current directory.

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

Define git clone.

A

It creates a local copy of a remote repository.

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

True or false: git add stages changes for commit.

A

TRUE

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

What is the purpose of git commit?

A

It saves the staged changes to the repository history.

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

Fill in the blank: git checkout allows you to switch to _______.

A

Another branch or commit

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

What does git status show?

A

It displays the state of the working directory and staging area.

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

What is the function of git pull?

A

It fetches changes from a remote repository and merges them.

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

True or false: git push uploads local commits to a remote repository.

A

TRUE

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

What does git branch do?

A

It lists, creates, or deletes branches in the repository.

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

Fill in the blank: git merge combines changes from _______.

A

One branch into another

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

What is git rebase used for?

A

It integrates changes from one branch into another by applying commits sequentially.

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

Define git stash.

A

It temporarily saves changes in the working directory without committing them.

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

What does git remote manage?

A

It manages the set of tracked repositories.

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

True or false: git fetch downloads changes but does not merge them.

A

TRUE

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

What is the purpose of git tag?

A

It marks specific points in the repository’s history as important.

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

Fill in the blank: git reset can be used to _______ changes.

A

Unstage or revert commits

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

What does git log display?

A

It shows the commit history for the current branch.

18
Q

Define git diff.

A

It shows the differences between various commits or the working directory.

19
Q

What is a git submodule?

A

A repository nested inside another Git repository.

20
Q

True or false: git cherry-pick applies commits from one branch to another.

21
Q

Fill in the blank: git config is used to _______ Git settings.

A

Set user preferences and repository settings

22
Q

What does git blame do?

A

It shows who last modified each line of a file.

23
Q

Define git archive.

A

It creates a compressed archive of files from a repository.

24
Q

What is git reflog?

A

It records updates to the tip of branches and allows recovery of lost commits.

25
True or false: **git clean** removes untracked files from the working directory.
TRUE
26
What does **git show** display?
It shows information about a specific commit or object.
27
Fill in the blank: **git commit -m** allows you to add a _______.
Commit message inline
28
What is the purpose of **git merge --no-ff**?
It creates a merge commit even if the merge could be fast-forwarded.
29
Define **git bisect**.
It helps find the commit that introduced a bug using binary search.
30
What does **git pull --rebase** do?
It fetches changes and applies local commits on top of the fetched changes.
31
True or false: **git revert** creates a new commit that undoes changes.
TRUE
32
What is the function of **git worktree**?
It allows multiple working directories for the same repository.
33
Fill in the blank: **git fetch --prune** removes _______ branches.
Deleted remote branches from local tracking
34
What does **git cherry** do?
It finds commits in one branch that are not in another.
35
Define **git hook**.
Scripts that run automatically at certain points in the Git workflow.
36
What is **git describe** used for?
It provides a human-readable name for a commit based on tags.
37
True or false: **git archive** can create a zip file of the repository.
TRUE
38
What does **git gc** do?
It cleans up unnecessary files and optimizes the local repository.
39
Fill in the blank: **git ls-files** lists _______ in the repository.
Files in the index and working directory
40
What is the purpose of **git pull request**?
It proposes changes to be merged into another branch, often used in collaboration.