Skip to content

Instantly share code, notes, and snippets.

@rickbacci
Last active September 22, 2015 21:58
Show Gist options
  • Save rickbacci/75efad4fe202867c1e11 to your computer and use it in GitHub Desktop.
Save rickbacci/75efad4fe202867c1e11 to your computer and use it in GitHub Desktop.

git revert

git log --oneline -4
git log --patch -3

git revert sha

get sha (at least 7 letters)

git ammend

git commit --ammend

git reset

git reset sha

git reset -- hard

wipes out history and files

will not affect untracked files will affect staged files

git reflog with show history of things that were deleted for a few weeks

git rebase git rebase (target) walks back to common ancestor and then roll forward

only do this if things arent pushed(public) git rebase -i master - (do this from a branch, and it will look like you did this after current master) git rebase -i origin/github-pages (safety net back to last thing that is not public)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment