unstage a directory from git code example Example 1: how to unstage a commit git reset HEAD~ Example 2: unstage staged files git git reset HEAD file_path