GIT - Coursera - Google Flashcards

1
Q

Which of the following commands is NOT an example of a method for comparing or reviewing the changes made to a file?

git log -p
git diff –staged
git add -p
git mv

A

git mv

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

What is the gitignore file?

A file containing a list of commands that Git will ignore.
A file the user is intended to ignore.
A file listing uncommitted changes.
A file containing a list of files or filename patterns for Git to skip for the current repo.

A

A file containing a list of files or filename patterns for Git to skip for the current repo.

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

What kind of file will the command git commit -a not commit?

Tracked files
New files
Old files
Staged files

A

New files

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

If we want to show some stats about the changes in a commit, like which files were changed and how many lines were added or removed, what flag should we add to git log?

  • -stat
  • -patch
  • 2
  • -pretty
A

–stat

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

git revert

A

With git revert, a new commit is created with inverse changes. This cancels previous changes instead of making it as though the original commit never happened (отменяет предыдущие изменения, но сохраняет историю.)

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

Let’s say we’ve made a mistake in our latest commit to a public branch. Which of the following commands is the best option for fixing our mistake?

git revert
git commit –amend
git reset
git checkout –

A

git revert

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

If we want to rollback a commit on a public branch that wasn’t the most recent one using the revert command, what must we do?

Use the git reset HEAD~2 command instead of revert

Use the revert command repeatedly until we’ve reached the one we want

use the commit ID at the end of the git revert command

Use the git commit –amend command instead

A

use the commit ID at the end of the git revert command

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

What does Git use cryptographic hash keys for?

To secure project backups
To guarantee the consistency of our repository
To encrypt passwords
To identify commits

A

to guarantee the consistency of our repository

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

What does the command git commit –amend do?

Start a new branch
Create a copy of the previous commit
Delete the previous commit
Overwrite the previous commit

A

Overwrite the previous commit

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

How can we easily view the log message and diff output the last commit if we don’t know the commit ID?

git show
git identify
git log
git revert

A

git show

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