how to unstage files for commit code example Example 1: git unstage file for commit git reset myfilename.txt Example 2: how to unstage a commit git reset HEAD~