Design and implement a source control strategy Flashcards

(48 cards)

1
Q

What is a trunk based branching strategy

A

Most work happens directly on the main branch with short-lived branches for small changes

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

What is a feature branch strategy

A

Each new feature or bug fix gets its own branch which is merged back to main when complete

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

What is a release branch strategy

A

Branches are created at release time to stabilize code while new features continue in development branch

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

Why use trunk based development

A

Optimizes for continuous integration reduces merge conflicts and speeds up delivery

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

When are feature branches preferred

A

When teams want to isolate and develop features or fixes independently from main branch

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

What is the main benefit of release branches

A

Allows stabilization and bug fixes for releases without blocking new development

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

What is a pull request in Git

A

Request to merge changes from one branch into another typically reviewed by others

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

How do branch policies improve pull request workflow

A

Enforce code reviews successful builds or status checks before merging

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

How do branch protections enhance code quality

A

Prevent direct pushes and require checks or approvals before accepting code

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

What restriction can you place on a branch to prevent unwanted changes

A

Require pull requests and protect branch from force pushes

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

What does branch merging restriction mean

A

Limiting who can merge specific branches and under what conditions

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

How do you configure branch protection in GitHub

A

Use branch protection rules in repository settings to set requirements

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

How can Azure Repos enforce branch policies

A

Set up policies for required reviewers build validation and work item linking

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

What tool can you use to manage large binary files in Git

A

Git Large File Storage LFS

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

When should you use git-fat or Git LFS

A

When storing files too large for normal Git such as media or build artifacts

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

How does Git LFS store large files

A

Replaces large files with pointers and stores actual content in an external server

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

What is Scalar used for in Git

A

Helps scale and optimize large monorepos for performance

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

How does cross repository sharing work in Git

A

Submodules or subtrees allow sharing code across multiple repos

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

What can help reduce repository size over time

A

Prune old branches use Git GC and remove unnecessary large files

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

How do you restrict user access to parts of a repo in GitHub

A

Set branch or directory permissions and use teams or roles

21
Q

What is a permission setting in Git

A

Defines what users or groups can read write or admin repositories or branches

22
Q

Why use tags in a Git repository

A

Mark important commits such as releases or milestones for easy reference

23
Q

How do you create a tag in Git

A

Run git tag tagname at the desired commit

24
Q

How do you list tags in a repository

A

Run git tag command in the repo directory

25
How can tags help with deployments
Deployments can target specific tags ensuring consistent releases
26
How do you recover a deleted file in Git
Use git checkout commitsha filename or git restore or git reflog
27
How can you revert a commit in Git
Use git revert commitsha to create a new commit undoing the change
28
What git command shows the history of changes
git log
29
How do you search for a specific commit by message
git log with grep or a search term
30
How can you remove sensitive data from Git history
Use git filter-branch BFG Repo Cleaner or git rebase to rewrite history
31
Why is it important to clean sensitive data from Git
To prevent accidental leaks of credentials or private information
32
What is the purpose of .gitattributes file
Configures how Git handles files including LFS and end of line normalization
33
How do you optimize clone times for large repos
Prune unnecessary history and use shallow clones with git clone depth
34
What strategy can help handle multiple active releases
Use separate release branches for each active version
35
How do you enforce naming conventions for branches
Establish naming policies and use branch protections or scripts
36
Why use pull request templates
To standardize expectations and ensure consistent code review information
37
How do you prevent merge conflicts in a busy team
Rebase frequently and encourage small pull requests
38
What is fast forward merge in Git
Merges a branch with no intervening commits by advancing target branch pointer
39
How do you squash commits during merge
Use squash option in pull request or git merge squash manually
40
What is the benefit of tagging before a release
Ensures the deployed code version can be easily referenced and recovered
41
How would you retrieve a file as it existed in a past commit
git checkout commitsha filepath or git show
42
How can you see who changed a line in a file
git blame filename
43
What is a submodule in Git
Reference to another Git repository inside your project for versioned dependencies
44
What is the difference between branch delete and prune
Delete removes a branch reference prune cleans up stale remote refs
45
Why periodically clean up branches
To reduce confusion improve performance and make repository navigation easier
46
How do you merge changes from one branch into another
git merge or open a pull request to the target branch
47
How can you make sure no one force pushes to protected branches
Enable branch protection rules in source control settings
48
What process do you follow to approve a pull request
Ensure successful builds required reviews and policy checks before merging