Does the implementation of this function will get the pending commits properly when the user switched to an other local branch?