Everything you need to know to master git, Part 3 (git checkout and git clean)

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:

to rollback changes for the entire local copy while keeping added files:

 

if you just want to remove the file and directories that have been added but not staged:

-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.

Leave a Reply

avatar
  Subscribe  
Notify of