Snapshotting Flashcards

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

How do you stage all changes for commit?

A

git add .

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

How do you commit staged changes with a message?

A

git commit -m “Commit message”

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

How do you view the status of your working directory and staging area?

A

git status

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

How do you show the differences between the working directory and the last commit?

A

git diff

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

How do you unstage a file while retaining the changes in the working directory?

A

git reset HEAD filename

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

How do you amend the last commit with new changes?

A

git commit –amend

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

How do you restore a file from the last commit to the working directory?

A

git checkout – filename

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

How do you create a commit that includes changes from all tracked files?

A

git commit -a -m “Commit message”

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

How do you show the changes staged for the next commit?

A

git diff –cached

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

How do you list all the files that are being tracked by Git?

A

git ls-files

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

How do you stage a portion of a file’s changes?

A

git add -p filename

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

How do you show the changes made by the last commit?

A

git show

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

How do you commit all changes in the working directory with a message?

A

git commit -am “Commit message”

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

How do you revert changes in the working directory to the last commit?

A

git checkout .

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

How do you display the history of a file including renames?

A

git log –follow filename

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

How do you show a summary of changes in each commit?

A

git log –stat

17
Q

How do you create a patch for the changes in the working directory?

A

git diff > patchfile.patch

18
Q

How do you apply a patch file to the working directory?

A

git apply patchfile.patch

19
Q

How do you commit changes with a verbose message

A

showing the diff in the editor?

20
Q

How do you show the differences between two commits?

A

git diff commit1 commit2

21
Q

How do you stage files interactively

A

allowing partial commits?

22
Q

How do you list the files that have been modified but not yet committed?

A

git diff –name-only

23
Q

How do you show a graphical representation of the commit history?

A

git log –graph

24
Q

How do you display the commit history on a single line per commit?

A

git log –oneline

25
Q

How do you show the changes introduced by each commit in the history?

A

git log -p