git stash and apply
Before going forward Hopes you know to use git.
When to use git stash
Say you are in a situation where you have all your changes in local machine.
now you are checking for status by
You have shown list of files to be commit,
Also you don't want to commit your changes now because your task is not completed yet, But now the situation is where your colleague committed something to git repo and your further work/task is related to his/her(colleague) changes or commits, so your further changes has to be top of his commits.
So what you do now ?
You are going to pull the changes from repo by git pull, am I right ?
I would say if there is some changes that are in same files where colleague's changes and your's ,
Your pull operation will be aborted or there might be a chance of merge / conflict /code lost whatever.
So to overcome this thing you are going to do the small thing by small command
this will save your changes somewhere in your local machine, so now you do git pull
git pull git stash apply
git stash apply is used to apply your stashed and keep safe or back up this changes for future updates too.
If you dont want your changes for future commits you could simply use
git stash pop
this will remove your changes from stash
Hopes now you are clear
See you soon with next aritcle :)