Cleaning up git environment and rollbacking local changes
Once you started working on your local copy you might mess everything and need to clean up or roll back changes for some file, you can use git checkout and git clean
to rollback changes for a particular file:
1 |
git chekcout <filename> |
to rollback changes for the entire local copy while keeping added files:
1 |
git checkout . |
if you just want to remove the file and directories that have been added but not staged:
1 |
git clean -d –dry-run -i |
-d
Remove untracked directories in addition to untracked files.
–dry-run
Don’t actually remove anything, just show what would be done.
-i
Show what would be done and clean files interactively. See “Interactive mode” for details.