See also checkout.
Sep 14, git-clean - Remove untracked files from the working tree Synopsis git clean [-d] [-f] [-i] [-n] [-q] [-e ] [-x -X] [--] Description. Cleans the working tree by recursively removing files that are not under version control, starting from the current directory. Normally, only files unknown to Git are removed, but if the -x option is specified, ignored files are also removed.
If you want to remove those files too, you can add a -x to the clean command.
Remove a file from a git repository with: git filter-branch --tree-filter 'rm file' Remove a folder from a git repository with: git filter-branch --tree-filter 'rm -rf directory' This removes the directory or file from all the commits. You can specify a commit by using: git filter-branch --tree-filter 'rm. git checkout--detach  git checkout [--detach]. Prepare to work on top of, by detaching HEAD at it (see"DETACHED HEAD" section), and updating the index and the files in the working tree.
Local modifications to the files in the working tree are kept, so that the resulting working tree will be the state recorded in the commit plus the local modifications. --force-remove.
Remove the file from the index even when the working directory still has such a file. (Implies --remove.)--replace. By default, when a file path exists in the index, git update-index refuses an attempt to add path/file. Similarly if a file path/file exists, a file path cannot be added.
With --replace flag, existing entries.