giovedì 25 agosto 2011

Git, undoing uncommitted changes

You have the staged file HelloWorld.java, you have modified it and staged those changes but then you want to unstage those changes :

git reset HEAD -- HelloWorld.java

You have a new file HelloWorld.java, you have added it to staged files but then you do not want to commit the new file:

git rm --cached  HelloWorld.java

if you want to undo all changes:

git checkout

Be careful,  git checkout removes all untracked changes and you can't recover those changes anymore (files never tracked by Git will be deleted).


Nessun commento:

Posta un commento