Cleaning your mistakes
The first thing to know is that you can always clean your mistake with Git. Sometimes this will be hard or painful for your code, but you can do it!
Let's start this section with how to remove untracked files:
Erik@server:~$ git clean -n
–n option will make a dry-run (it's always important to see what will happen before you regret it).
If you want to also remove directories and hidden files, use this one:
Erik@server:~$ git clean -fdx
With these options, you will delete new directories (
-d) and hidden files (
-x) and be able to force them (
Reverting uncommitted changes
To explain this section, we will use an example. Let's suppose you edited a file on the production working directory, but didn't commit it. On your last ...