You propably know the situation: you’re working on a new feature and suddenly someone interrupts you. This situation happens when you must work on an incoming bug or when someone pushed to the repository and you must continue working on this new commit.
With Git, you can simply store your changes locally and pull the latest commit from the remote repository. After pulling, you can work directly on the pulled commit or you can merge you previously saved changes and continue working on them.
The following snippet shows the commands for storing your changes locally and merging them into the head after pulling new changes:
git pull
git stash pop