mdawar.dev

A blog about programming, Web development, Open Source, Linux and DevOps.

Git Discard File Changes

(Updated: )

Discard uncommitted changes for a specific file.

bash
$git restore <filename>
$# Or
$git checkout -- <filename>

Discard uncommitted changes for the current directory.

bash
$git restore .
$# Or
$git checkout -- .