I’ve always heard the best practice is to pull before you push, but this is obvious, you can’t even push if you don’t have the commits from upstream, it will simply fail. Maybe what we should make obvious here is, when we are modifying same files as other team(s) if we should either:
-
pull before push as in stash changes, pull, pop stash, commit changes and push.
-
pull before push as in commit your changes, pull, resolve conflicts, push.
Number 1 has an issue, when you pop stash, you should check to see if they pull has modified any files you are working on, and if so, add their changes manually to the code otherwise we will be removing their work, and will cause issues.
Number 2 has two issues, you are forced to make a commit that maybe you don’t want to make at this point because it has not reached a staged to call it a commit. And you also have to resolve conflicts in resolve manager.
So what’s the best practice here?
1