Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save shravankb/e1ee62dd545eb473bf61bffe6fd79e55 to your computer and use it in GitHub Desktop.

Select an option

Save shravankb/e1ee62dd545eb473bf61bffe6fd79e55 to your computer and use it in GitHub Desktop.
git restore filename
git restore -p filename (patch level)
git restore .
git commit --amend -m "change last commit"
git revert <commit hash> # creates a new commit at head that undoes a previous commit
get reset --hard --soft --mixed <hash>
git reflog # look at the history of the head pointer
git branch <name> <hash> # starts the branch at a particular hash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment