Páginas

viernes, 9 de enero de 2015

Git stash

I want to share a really usefull command for the control version system Git.
If you are working on a branch, and you really do some changes in that branch, before you can move from this branch, Git says you that you can not go before commit your changes.
You can do commit but if your task is not finished, you can "freeze" your changes in your current branch and move to another branch without making commits to this way:
 
git stash

At this moment, you are able to move to other branch of development, do whatever you want and, if you want to get back to your branch and recover your old work, only you have to write in your command line:

git stash apply

And your work will go back, like magic!. I consider this really great to work without lose your changes with no commit in the middle.
One thing more, if you have multiples stashes in your branch, you can restore the stash you want. To list them:

git stash list

And later, choose what stash you want to restore with:

git stash name_stash

That's all!

No hay comentarios:

Publicar un comentario