Udacity lesson 6 Flashcards
alter the most-recent commit
git commit –amend
reverse a given commit
git revert number_of_the_commit
delete a commit
git reset commits_number_or_relative_reference
what does git commit –amend do?
lets you provide a new commit message, or
you could edit, stage and save files with changes that should logically belong to this commit and not to a commit of their own, and then use git commit –amend, and these changes will be added to that old commit
I’ve forgotten to make some changes that belong to my last commit. what to do?
what does git revert number_of_the_commit do?
Git takes the changes that were made in commit and does the exact opposite of them, and then makes a commit to reflect this change
If a character is added in commit A, then Git will make a new commit where that character is deleted. It also works the other way where if a character/line is removed, then reverting that commit will add that content back!
reset vs revert
Reverting creates a new commit that reverts or undos a previous commit. So you have all the commits on the branch: both initial one and the reverted one
Resetting, on the other hand, erases commits, so you can’t undo this
I’ve reset a commit. is there a way back?
yes, for about 30 days. git reflog gives you access to the deleted content
relative referencing of commits
what can git reset commits_reference do?