Basic Git Commands Flashcards

1
Q

add

A

Add file contents to the index

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

bisect

A

Find by binary search the change that introduced a bug

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

branch

A

List, create, or delete branches

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

checkout

A

Checkout a branch or paths to the working tree

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

clone

A

Clone a repository into a new directory

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

commit

A

Record changes to the repository

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

diff

A

Show changes between commits, commit and working tree, etc

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

fetch

A

Download objects and refs from another repository

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

grep

A

Print lines matching a pattern

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

init

A

Create an empty git repository or reinitialize an existing one

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

log

A

Show commit logs

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

merge

A

Join two or more development histories together

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

mv

A

Move or rename a file, a directory, or a symlink

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

pull

A

Fetch from and merge with another repository or a local branch

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

push

A

Update remote refs along with associated objects

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

rebase

A

Forward-port local commits to the updated upstream head

17
Q

reset

A

Reset current HEAD to the specified state

18
Q

rm

A

Remove files from the working tree and from the index

19
Q

show

A

Show various types of objects

20
Q

status

A

Show the working tree status

21
Q

tag

A

Create, list, delete or verify a tag object signed with GPG

22
Q

What is the HEAD?

A

Refers to last commit on the branch/timeline that we’re currently on

23
Q

git reset –soft HEAD^

A

Undo last commit, put changes into staging

24
Q

git commit –amend -m “New Message”

A

Change the last commit

25
Q

git commit –hard HEAD

A

Undo last commit and all changes

26
Q

git reset –hard HEAD^^

A

Undo last 2 commits and all changes

27
Q

How to add new remote repo?

A

git remote add <address>

28
Q

How to remove remote repo?

A

git remote rm

29
Q

How to push to remote repo?

A

git push -u (branch is usually master)