I read the following post: How do you git fetch then merge? "Error: Your local changes to the following files would be overwritten by merge"
I work with my friend on the same branch with git. When he did changes to our project and he pulls the project, he gets the error, that his local changes will be overwritten.
Is this a possible workflow in order to push his new changes:
git commit
git pull (or fetch and merge)
git push
Or is git stash
better than git commit
You should usually only commit if you have a complete changeset (which usually means it compiles without warnings, all tests pass, and it achieves some logical improvement).
If you have such a "complete" change, by all means, you should commit it. If not, it's probably better to stash your changes, pull from the remote, and pop the stashed changes back to your working index.