Back
Syntax
Study
Editor
Mode:
HTML
CSS
JavaScript
PHP
Reset
Run »
HTML / CSS / JS
# Unstage a file (keep your working directory changes): git restore --staged index.html # Unstage everything: git restore --staged . # Discard working directory changes to a file # WARNING: This permanently discards unsaved changes! git restore index.html # Discard ALL working directory changes: git restore . # Restore a file to its state at a specific commit: git restore --source=HEAD~2 index.html # Old syntax (still works, but restore is preferred): # git reset HEAD index.html <- unstage # git checkout -- index.html <- discard changes # Check what you are about to commit: git status git diff --staged # Remove an untracked file (dry run first): git clean -n # preview what would be removed git clean -f # actually remove untracked files git clean -fd # also remove untracked directories
Result
Open