Git Basics Flashcards

1
Q

What kind of program is Git?

A

Git is a version control system.

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

What are the differences between Git and a text editor in terms of what they save and their record keeping?

A

Git: Saves differences in files and folders and keeps all historical versions.

Text Editor: Only one version of the file.

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

Does Git work at a local or remote level?

A

The local level.

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

Does GitHub work at a local or remote level?

A

The remote level.

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

Why is Git useful for an individual developer?

A

Allows to historically track why/when individual developer did what they did with code

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

Why are Git and GitHub useful for a team of developers?

A

Allows the team to collaborate with one another and see who changed a file and why they changed a file

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

How do you create a new repository on GitHub?

A

Press the + button next to the profile icon and click on new repository.

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

How do you copy a repository onto your local machine from GitHub?

A

‘git clone git@github.com:USER-NAME/REPOSITORY-NAME.git’.

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

What is the default name of your remote connection?

A

Origin

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

Explain what origin is in git push origin main.

A

Origin is the name of the remote repository that the main branch is being merged to.

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

Explain what main is in git push origin main.

A

Main is the default branch of the file’s respective local repository.

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

Explain the two-stage system that Git uses to save files.

A

git add file-name: Places the file in a ‘waiting room’ with the changes made to the file.

git commit file-name: Approves the file so it can be pushed out and copied remotely.

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

How do you check the status of your current repository?

A

‘git status’.

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

How do you add files to the staging area in git?

A

‘git add .’ if you have multiple files to add.

‘git add file-name’ if you have a single file to add.

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

How do you commit the files in the staging area and add a descriptive message?

A

‘git commit -m “Your message here.” ‘

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

How do you push your changes to your repository on GitHub?

A

‘git push’ if you only have a main branch

‘git push origin branch-name’ if you’re working off another branch

17
Q

How do you look at the history of your previous commits?

A

‘git log’

18
Q

What are two benefits of having well-written commit messages and a good commit history?

A
  1. It establishes consistent and concise communication to you and your team
  2. Helps maintain the project log and the team is able to see who worked on what changes
19
Q

How many characters should the subject line of your commit message be?

A

Around 50 characters but no more than 72.