2017年1月21日星期六

Git: stash and checkout

 
As we know, if you want to checkout, you must need to clean your working DIR.
That's it, create a commit or stash you change.
Stash, means save your files on a temporary place in a stack data structure.
Below is a example on this.



We have un-stage files on the working directory. So , the working DIR is not clean.
image
If we want to checkout, Git give you below error
image
But I don't want to commit . Therefore, stash the files.
image
Working DIR is clean now!!
image
image
Perfect!! Checkout then.No problem on checkout!!
image
Go back to our master
image
Same as my expected, my working DIR is clean.
Lets get it back of my previous work on the master.
Here we are, my works back! Welcome home~~
image
Conclusion
For me, it is not efficiency….I rather than just simply commit it then checkout.
Stash is not much useful….
This is just for my interest to know how stash work.Ha!
























沒有留言:

發佈留言