GIT Flashcards

1
Q

What command is used to start a git repository in a folder?

A

git init

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

What are the three parts of a git project?

A

1) A Working Directory: Where you do all the work: creating, editing, deleting and organising files.
2) A staging area where you will list changes made to the working directory
3) A Repository: Where GIT permanently strores these changes as different versions of the project.

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

What is the command to save changes made in the working directory?

A

git commit

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

What is the command to add untracked files to the staging area?

A

git add

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

What does git status do?

A

Checks the status of the changes you have made to the working directory

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

What is an untracked file?

A

An untracked file means that GIT sees the file but has not started tracking changes yet.

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

How can you check the changes between the staging area and the working directory?

A

git diff

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

What is the command added to git commit to add a comment to the commit?

A

-m ‘text goes here’

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

What does git log do?

A

Gives you a list of your commits.

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

What is the HEAD commit and what does git show HEAD output?

A

The HEAD commit is the commit you are currently on. The output of the command shows everything the git log command would show and also the file changes that were committed.

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

How would you restore the working directory to the last commit you made?

A

git checkout HEAD changes.txt

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

How do you remove a file from the staging area?

A

git reset HEAD changes.txt

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

What do you add to git reset to revert to a specific commit?

A

The first 7 characters of the SHA of a previous commit. A SHA looks like ‘5d692065cf51a2f50ea8e7b19b5a7ae512f633ba’

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

What command can be used to check what branch you are on?

A

git branch

The * in the output indicates what branch you are on

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

What command is used to make a new branch?

A

git branch name_of_new_branch

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

What command is used to swap to a different branch?

A

git checkout name_of_new_branch

17
Q

What is the command used to add the changes from one branch into another?

A

git merge branch_name

18
Q

How do you delete a branch?

A

git branch -d branch_name

19
Q

How to you copy a repository from another location?

A

git clone name/location of repository your_name_for_repository

20
Q

What does the command git remote -v do?

A

git remote -v lists the name and location from which the repository was cloned.

git remote will list only the name (normally set as origin)

21
Q

How do you check is changes have been made to the origin repository you have cloned?

A

git fetch