How to revert uncommitted changes including files and folders?

Is there a git command to revert all uncommitted changes in a working tree and index and to also remove newly created files and folders? 1 14 You can run these two commands: # Revert changes to modified files. git reset –hard # Remove all untracked files and directories. # ‘-f’ is force, ‘-d’ is … Read more

Why are there two ways to unstage a file in Git?

Sometimes git suggests git rm –cached to unstage a file, sometimes git reset HEAD file. When should I use which? EDIT: D:\code\gt2>git init Initialized empty Git repository in D:/code/gt2/.git/ D:\code\gt2>touch a D:\code\gt2>git status # On branch master # # Initial commit # # Untracked files: # (use “git add <file>…” to include in what will … Read more