Git Flashcards

1
Q

What is Git?

A

Git is a distributed version control system designed to handle projects of all sizes efficiently.

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

How does Git differ from SVN?

A

Git is distributed, every dev’s copy is a full-fledged repository, unlike SVN’s single repository approach.

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

What is a ‘commit’ in Git?

A

A commit in Git is a snapshot of your repository’s history at a specific point, containing changes and a message.

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

Explain ‘branching’ in Git.

A

Branching lets developers diverge from the main code base for new features or fixes without affecting the main line.

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

What is a ‘merge’ in Git?

A

Merging is integrating changes from one branch into another in Git.

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

Define ‘rebase’ in Git.

A

Rebase is a method of moving a series of commits to a new base commit.

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

What is a ‘pull request’?

A

A pull request is a method of submitting contributions to a project, requesting the maintainer to pull your changes.

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

Describe ‘forking’ a repo.

A

Forking a repo involves making a personal copy of someone else’s project to work on it separately.

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

What is a ‘conflict’ in Git?

A

A conflict arises in Git when two branches have edits in the same line or one branch deleted a file that another modified.

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

How do you resolve a merge conflict in Git?

A

To resolve a merge conflict in Git, manually edit the files, then mark them as resolved and complete the merge.

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

Explain the concept of ‘blame’ in Git.

A

git blame shows who last modified each line of a file.

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

What is a ‘bare’ repository in Git?

A

A bare repository in Git is a repository that does not contain a working directory.

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

How do you rename a local Git branch?

A

Use git branch -m to rename a branch.

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

What does git push do?

A

git push uploads local repository content to a remote repository.

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

Explain ‘fast-forward’ merge in Git.

A

A fast-forward merge is where the target branch’s tip is advanced to the source branch’s tip.

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

How do you create a tag in Git?

A

Use git tag to create a new tag.

17
Q

What is a ‘detached HEAD’ in Git?

A

Detached HEAD means you are currently checking out a commit rather than a branch.

18
Q

Explain the use of git show.

A

git show is used to display various types of objects in Git.

19
Q

What is ‘origin’ in Git?

A

Origin is the default upstream repository in Git.

20
Q

How do you find a commit where a specific change was introduced?

A

Use git bisect to find the commit that introduced a bug.

21
Q

Explain the use of git submodule.

A

git submodule allows you to keep a Git repository as a subdirectory of another Git repository.

22
Q

What is git archive?

A

git archive is used to create an archive of the files from a named tree.

23
Q

How do you amend a commit in Git?

A

Use git commit --amend to amend the most recent commit.

24
Q

What is the use of git grep?

A

git grep is used to search for phrases and words in the Git repository.

25
Q

Explain the use of git blame -w.

A

git blame -w ignores whitespace when determining the author of a line.

26
Q

How do you list all the remote repositories configured?

A

Use git remote -v to list all configured remote repositories.

27
Q

What is git gc?

A

git gc is a housekeeping command that cleans up unnecessary files and optimizes the local repository.

28
Q

Explain the concept of ‘hooks’ in Git.

A

Hooks in Git are scripts that run automatically every time a particular event occurs in a Git repository.

29
Q

How do you list all tags in Git?

A

Use git tag to list all tags.

30
Q

What is git ls-tree?

A

git ls-tree lists the contents of a tree object, including blobs and subtrees.