Commands Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

Initialize a new Git repository

A

git init

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

Find the current state of a repository, including which files from previous commits have changed, what’s new and not currently tracked, and what has been moved or deleted

A

git status

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

Stages new or changed files, by file name

A

git add filename

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

Stages new or changed files, with anything and everything that is already tracking but is unstaged

A

git add -u

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

Takes a snapshot of the repo at any point in time, adding a message

A

git commit -m

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

Takes a snapshot of the repo at any point in time

A

git commit -a

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

Stages any unstaged changes

A

git add .

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

Used to see what has changed in a repo since the last commit

A

git diff

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

Used to see what has changed in a specific file since the last commit

A

git diff

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

Tells you how many changes have been made since the last commit and whether they are insertions or deletions

A

git diff —stat

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

Used to undo your work and go back to a commit that you haven’t shared with anyone else, also removing files and changes

A

git reset —hard

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

Used to look at a prior state of a repository

A

git checkout

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

Used to switch branches

A

git checkout

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

Used to create a new branch and switch over to it

A

git checkout -b

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

If you are in a detached head state looking at other HEADS, puts you back in the present

A

git checkout master

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

Go back and look at two commits prior

A

git checkout HEAD ~2

17
Q

Gives a list of all the commits of your code that have been made

A

git log

18
Q

Creates a new branch but does not go to that branch

A

git branch

19
Q

Gives a list of all the branches in the local repo

A

git branch -a

20
Q

Deletes a branch

A

git branch -d

21
Q

Used to merge changes from one branch to another

A

git merge