Git Flashcards

1
Q

What is version control? What makes git different from other version control software?

A

A distributed version control system involves cloning a Git repository. Version control enables teams to collaborate and streamline development to resolve conflicts and create a centralized location for code.

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

List the git commands you know and what they do

A

git add. Adds files
git commit. Commits files
git checkout. Checks out to a branch
git push. Pushes files to git repository

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

How would you prevent a file from being tracked by git?

A

using the git rm command with the –cached option.

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

What is a branch? What are some common branching strategies?

A

A branch represents an independent line of development. Branches serve as an abstraction for the edit/stage/commit process.

Git Flow is the most widely known branching strategy that takes a multi-branch approach to manage the source code. This approach consists of two main branches that live throughout the development lifecycle.

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

What is a merge conflict? How do you prevent these and resolve if it happens?

A

You can resolve merge conflicts using the command line and a text editor. Merge conflicts occur when competing changes are made to the same line of a file, or when one person edits a file and another person deletes the same file.

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

What is a GitHub pull request?

A

Pull requests let you tell others about changes you’ve pushed to a branch in a repository on GitHub.

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

What is the git workflow for editing code and saving changes?

A

The primary way to save your changes is to add them to Git’s staging area using the git add command and then commit using git commit. This saves your revision information in Git’s repository which makes it a part of your commit history.

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

What is a commit?

A

Commits are the core building block units of a Git project timeline. Commits can be thought of as snapshots or milestones along the timeline of a Git project. Commits are created with the git commit command to capture the state of a project at that point in time.

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

How would you go back in your commit history if you make a mistake?

A

use git log to get a list of previous commits. use git checkout and the id to revert to a previous commit.

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