chap 4 Flashcards

(8 cards)

1
Q

The most common correction to make is to the previous commit: you run git commit, and then realize you made a mistake

A

git commit –amend // keep commit message

git commit –amend -m”new message”

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

Show all the changes that you have done

A

git log

git log -g

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

display the file as it was on a previouse commit

A

git show theid
i.e.
git show 5023185775fa522b4665929fb13286e48a257247

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

Discard the last commit

A

git reset HEAD~

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

Discard any number of commits

A

git reset HEAD~3 // 2, 3 4, etc

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

Discard options

Just know they exist for now

A

–mixed
The default: makes the index match the given commit, but does not change the working files. Changes made since the last commit appear unstaged.
–soft
This resets the branch tip only, and does not change the index; the discarded commit’s changes remain staged. You might use this to stage all the changes from several previous commits, and then reapply them as a single commit.
–merge
Tries to keep your outstanding file changes while rewinding the branch, where this makes sense: files with unstaged changes are kept, while files differing between HEAD and the given commit are updated. If there is overlap between those sets, the reset fails.
–hard
Resets your working files to match the given commit, as well as the index. Any changes you’ve made since the discarded commit are permanently lost, so be careful with this option! Resist the urge to make an alias or shortcut for using git reset –hard; you will probably regret it.

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

Undoing an earlier commit

A

git revert 9c6a1fad
This will compute the diff between that commit and the previous one, reverse it, and then attempt to apply that to your working tree (you may have merge conflicts to resolve if intervening changes complicate doing that automatically). Git will prepare a commit message indicating the commit being reverted and its subject, which you can edit.

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

Further reset stuff on page 63 onwards

A

Juts be aware foe now

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