Skip to content

Instantly share code, notes, and snippets.

@yavuztas
Created October 21, 2019 13:33
Show Gist options
  • Save yavuztas/e6890c41cdc83b9363d0c0b33ea338ba to your computer and use it in GitHub Desktop.
Save yavuztas/e6890c41cdc83b9363d0c0b33ea338ba to your computer and use it in GitHub Desktop.
# Assuming you did not commit the file, or add it to the index, then:
git checkout -- filename
# Assuming you added it to the index, but did not commit it, then:
git reset HEAD filename
git checkout -- filename
# Assuming you did commit it, then:
git checkout origin/master filename
# Assuming you want to blow away all commits from your branch (VERY DESTRUCTIVE):
git reset --hard origin/master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment